0
私はGridViewのOnRowDeletedイベントでHiddenFieldをFindControl()しようとしています。GridViewの.FindControl()OnRowDeleted?
protected void gridviewPersonPhoto_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
//string strFileName = (the name of the file that needs to be deleted by System.IO
//which i will know after I FindControl() the HiddenField in the deleted row that contains the name)
}
<asp:GridView id="gridviewPersonPhoto" DataKeyNames"PersonPhotoId"
DataSourceId="sqldatasourcePersonPhoto" OnRowDeleted="gridviewPersonPhoto_RowDeleted">
<TemplateField>
<ItemTemplate>
<asp:HiddenField ID="hiddenfieldFileName value='<%#Eval("FileName")%>' />
<asp:Button ID="buttonDelete" CommandName="Delete" />
</ItemTemplate>
<ItemTemplate>
<asp:Image ID="imgPhoto" ImageUrl='<%# "~/pub/photo/"+(Eval("FileName")) %>' runat="server" />
</ItemTemplate>
</TemplateField>
</asp:GridView>
ここにHTMLコードがありますか? – Aristos
@Aristos、html/aspxを追加 –