G
Guest
Hi all,
I am trying to have a linkbutton control with the commandname property set.
However, when I invoke it, the CommandArgument property ends up coming to be
blank. However, if I click on the buttonfield control i get back the
rowindex in CommandArgument. Why is that? How do I get my custom linkbutton
to work?
public void GridView_Command(object sender, GridViewCommandEventArgs e)
{
switch (e.CommandName)
{
case "EditSelect":
Response.Write(e.CommandArgument);
Response.End();
GridView_Edit(Convert.ToInt32(e.CommandArgument));
break;
}
}
<asp:ButtonField ButtonType="Link" CommandName="EditSelect" HeaderText="ID"
Text="Edit" />
<asp:TemplateField HeaderText="ID" HeaderStyle-HorizontalAlign="left"
ItemStyle-HorizontalAlign="left">
<ItemTemplate>
<asp:LinkButton ID="btnedit" runat="server" Text='<%#Eval("feeid") %>'
CommandName="EditSelect" />
</ItemTemplate>
</asp:TemplateField>
TIA!
I am trying to have a linkbutton control with the commandname property set.
However, when I invoke it, the CommandArgument property ends up coming to be
blank. However, if I click on the buttonfield control i get back the
rowindex in CommandArgument. Why is that? How do I get my custom linkbutton
to work?
public void GridView_Command(object sender, GridViewCommandEventArgs e)
{
switch (e.CommandName)
{
case "EditSelect":
Response.Write(e.CommandArgument);
Response.End();
GridView_Edit(Convert.ToInt32(e.CommandArgument));
break;
}
}
<asp:ButtonField ButtonType="Link" CommandName="EditSelect" HeaderText="ID"
Text="Edit" />
<asp:TemplateField HeaderText="ID" HeaderStyle-HorizontalAlign="left"
ItemStyle-HorizontalAlign="left">
<ItemTemplate>
<asp:LinkButton ID="btnedit" runat="server" Text='<%#Eval("feeid") %>'
CommandName="EditSelect" />
</ItemTemplate>
</asp:TemplateField>
TIA!