Hello,
I can't pass a gridview commandargument to the popup ajax ModalPopupExtender when I try to edit event.
Can you help me?
My code below
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:ImageButton ID="btnedit" runat="server" CommandName="Edit"
CommandArgument='<%# Eval("tkt") %>' ImageUrl="/aspnet/img/edit_icon.gif" />
</ItemTemplate>
</asp:TemplateField>
protected void gvProducts_RowEditing(object sender, GridViewEditEventArgs e)
{
ModalPopupExtender1.Show();
Button btn = (Button)sender;
string t = btn.CommandArgument.ToString();
Response.Write(t);
}
Error
Unable to cast object of type 'System.Web.UI.WebControls.GridView' to type 'System.Web.UI.WebControls.Button'.