B
Bazza Formez
Hello,
In my aspx file I have a LinkButton inside a template column, inside a
datagrid.
I have assigned a CommandName to the button.
In my code behind, I attempt to trap the command in the ItemCooamd for
the Datagrid.
I have used this successfully before with no problems. This time
however, the button will not fire ItemCommand.
I can't see anything wrong after a long time looking. Note that the
datagrid definitely has an id of dg_Users
Please can someone help ?
Thanks.
====================================================
Here is a the aspx code for the template column inside the datagrid :
asp:TemplateColumn SortExpression="Name" HeaderText="Name (click name
to edit)"> <HeaderStyle HorizontalAlign="Left" Width="40%"
CssClass="grid-header" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle CssClass="grid-first-item"></ItemStyle>
<ItemTemplate><asp:LinkButton runat="server" ID="btnLinkUsers"
Text="Edit User" CommandArgument='<%# DataBinder.Eval(Container,
"DataItem.UserName") %>' CommandName="InvokeEditUser"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
======================================================
Here is the code behind (which is never invoked)
Sub dgUsers_ItemCommand(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
If e.CommandName = "InvokeEditUser" Then
Response.Redirect("ClientUserDetail.aspx?UserName=" &
CType(e.CommandArgument, String) &
"&index={0}&adminindex={1}&clientid=" & ClientID)
End If
End Sub
======================================================
In my aspx file I have a LinkButton inside a template column, inside a
datagrid.
I have assigned a CommandName to the button.
In my code behind, I attempt to trap the command in the ItemCooamd for
the Datagrid.
I have used this successfully before with no problems. This time
however, the button will not fire ItemCommand.
I can't see anything wrong after a long time looking. Note that the
datagrid definitely has an id of dg_Users
Please can someone help ?
Thanks.
====================================================
Here is a the aspx code for the template column inside the datagrid :
asp:TemplateColumn SortExpression="Name" HeaderText="Name (click name
to edit)"> <HeaderStyle HorizontalAlign="Left" Width="40%"
CssClass="grid-header" VerticalAlign="Middle"></HeaderStyle>
<ItemStyle CssClass="grid-first-item"></ItemStyle>
<ItemTemplate><asp:LinkButton runat="server" ID="btnLinkUsers"
Text="Edit User" CommandArgument='<%# DataBinder.Eval(Container,
"DataItem.UserName") %>' CommandName="InvokeEditUser"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
======================================================
Here is the code behind (which is never invoked)
Sub dgUsers_ItemCommand(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
If e.CommandName = "InvokeEditUser" Then
Response.Redirect("ClientUserDetail.aspx?UserName=" &
CType(e.CommandArgument, String) &
"&index={0}&adminindex={1}&clientid=" & ClientID)
End If
End Sub
======================================================