I have a whdg with 2 bands. On the second band I have a column which contains buttons. How can I reach the click event of said button(s)?
In your page load you need to attach the command to a method like this:
AddHandler MyWebHierarchicalDataGrid.GridView.ItemCommand, New Infragistics.Web.UI.GridControls.ItemCommandEventHandler(AddressOf MyCommand)
The method that handles the command which looks like this:
Private Sub MyCommand(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.HandleCommandEventArgs) Dim lb As ImageButton = TryCast(sender, ImageButton) If lb IsNot Nothing Then Select Case lb.ID Case "MyImageButton1"
Case "MyImageButton2"
End Select
End Sub
This way you should be able to catch the command and handle it.
How can you catch the itemcommand in code behind? I can't seem to find it. Tnx
Hi,
For VB in your markup:
<ig:TemplateDataField Key="InsertNewLine"> <ItemTemplate> <asp:LinkButton runat="server" ID="lnkInsertLine" CommandName="Insert" CommandArgument='<%# DataBinder.Eval(CType(Container, Infragistics.Web.UI.TemplateContainer).DataItem, "AutoNumber") %>' >I</asp:LinkButton> </ItemTemplate><Header Text="" /></ig:TemplateDataField>
You can access any field you like and you can also access the row.index.
In you server side code you capture the itemcommand event of the WHDG and the commandargument will contained the passed values.
Ed