Infragistics4.Web.v11.1, Version=11.1.20111.1006
Microsoft .NET Framework Verions 4.0.30319 SP1Rel
I have a WebHierarchicalDataGrid with a TemplateDataField that contains a asp:Button in the child Band. When the user clicks on the Button, I need to catch the Button Click event on the server and know the row's data that the button is located in. I am currently doing it a crazy way that is not giving me the row data and I am sure there is a better way of doing this. I have created a second hidden button outside of the grid. In Javascript, catch the Grid_Click event, check if the column selected is the one that contains my button, then fire the second hidden button. On the server side, I can get this button but on the row where the orginal button is located. Can you help me please?
<ig:TemplateDataField Key="DocuSignSigner" Width="60px"><ItemTemplate><asp:Button ID= "btnDocuSignSigner" runat="server" Text ="Sign" SkinID="ResizedButton" Width ="60px"/></ItemTemplate><Header Text="" /></ig:TemplateDataField>
<
asp:Button ID="btnDocuSignSignerServer" runat="server" Style="visibility:hidden; "/>
BLOCKED SCRIPT
case 'DocuSignSigner':
var btnDocuSignSignerServer = $get('<%=btnDocuSignSignerServer.ClientID%>');
btnDocuSignSignerServer.click();
Hi IntegraSys76,
Thank you for posting in the community.
You should be able to get access the grid row of the respective clicked row in the templated buttons Click handler using the sender parameter. For instance:
Button button = (Button)sender; TemplateContainer templateContainer = ((Infragistics.Web.UI.TemplateContainer)(((Button)(sender)).Parent)); GridRecordItem item = (GridRecordItem) (templateContainer.Item); GridRecord row = item.Row;
Please let me know if this helps.
My button within the grid template now fires the server side event. I had to change the Private in front of the Sub to Public. Here is my code in case it helps someone else.
<ig:TemplateDataField Key="DocuSignSigner" Width="60px"><ItemTemplate><asp:Button ID= "btnDocuSignSigner" runat="server" Text="Sign" OnClick="btnDocuSignSigner_Click"/></ItemTemplate><Header Text="" /></ig:TemplateDataField>
Public Sub btnDocuSignSigner_Click(ByVal sender As Object, ByVal e As EventArgs)
signerButton =
CType(sender, System.Web.UI.WebControls.Button)
signerButtonTemplate =
CType(signerButton.Parent, TemplateContainer)
gridRecordItem =
CType(signerButtonTemplate.Item, GridControls.GridRecordItem)
Thank you for your reply and for sharing your solution with the community. Please feel free to contact me if you need further assistance.
I can now get at the parent row data of the WHDG from an ASP:Button click on the server but how do I get at the Child row data? The button is on the parent level.