在代码中 在此代码中,我可以更新文件夹路径中的图像,但图像文件名因此无法保存在数据库中,我认为我的图像没有显示 gridview 请帮助我
<EditItemTemplate>
<asp:FileUpload ID="photoTextBox" runat="server" filename='<%# Bind("photo")%>.jpg' />
</EditItemTemplate>
<ItemTemplate>
<img alt="" src="ImageStorage/<%# Eval("personalid") %>.jpg" width="40" height="40" id="image1" />
<asp:Label ID="photoLabel" runat="server" Text='<%# String.Concat(Eval("personalid"),".jpg")%>' ></asp:Label>
</ItemTemplate>
C#
protected void RadGrid4_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "Update")
{
GridEditableItem eitem = e.Item as GridEditableItem;
FileUpload photoTextBox = eitem.FindControl("photoTextBox") as FileUpload;
TextBox personalidTextBox = eitem.FindControl("personalidTextBox") as TextBox;
Label photoLabel = eitem.FindControl("photoLabel") as Label;
string filename = Path.GetFileName(personalidTextBox.Text + ".jpg");
photoTextBox.SaveAs(Server.MapPath("ImageStorage/" + filename));
}
}