Dears,
Why I'm getting this error?
What I'm trying to do is that I have WebDataGrid with TemplateColumn with a button, when I click on the button it spouse to get the column "leaveref" value and assign it to a session and then transfer me to a new page using a JavaScript function.
I can't get the value of the clicked row using JS! The Activation and Selection in the behaviors are activated.
Any help please? I am using Asp.net with Infragistics 2018 Vol.2
Hello Osama,
I am glad that you find my suggestion helpful.
Thank you for using Infragistics components.
Finaaaaaaaaallly, thank you so much for your support, I'm really thankful.
When master page is used then the child page control names will automatically change based the content place holder id. My suggestion is to use code render block to retrieve the actual ID:
var grid = $find("<%= WebDataGridt.ClientID %>");
Please let me know if you need any further assistance with this matter.
Thank you for your help and support, now I have created a new empty asp.net page for testing , and it's working fine as below code"
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ff.aspx.vb" Inherits="Leave_Request.ff" %> <script src="Scripts/jquery-1.10.2.min.js" type="text/javascript"></script> <script type="text/javascript"> function getCellValue() { var grid = $find("WebDataGridt"); var usingRowSelection = grid.get_behaviors().get_activation().get_activeCell().get_row().get_cellByColumnKey("test").get_text() alert(usingRowSelection); } </script> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <ig:WebDataGrid ID="WebDataGridt" runat="server" Height="350px" Width="400px"> <Columns> <ig:TemplateDataField Key="TemplateField_0"> <ItemTemplate> <asp:Button ID="Button1" runat="server" OnClientClick="getCellValue()" Text="Button" /> </ItemTemplate> <Header Text="TemplateField_0"> </Header> </ig:TemplateDataField> <ig:BoundDataField DataFieldName="test" Key="test"> <Header Text="BoundColumn_0"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="test1" Key="test1"> <Header Text="BoundColumn_0"> </Header> </ig:BoundDataField> </Columns> <Behaviors> <ig:Activation> </ig:Activation> </Behaviors> </ig:WebDataGrid> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> </form> </body> </html>
NOW, I have create another page linked to a master pager, I copied the same code as below, but it didn't work!! it's very strange!! the code of the other page which is linked to a master page.
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="test.aspx.vb" Inherits="Leave_Request.test" %> <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server"> <script src="Scripts/jquery-1.10.2.min.js" type="text/javascript"></script> <script type="text/javascript"> function getCellValue() { var grid = $find("WebDataGridt"); var usingRowSelection = grid.get_behaviors().get_activation().get_activeCell().get_row().get_cellByColumnKey("test").get_text() alert(usingRowSelection); } </script> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <ig:WebDataGrid ID="WebDataGridt" runat="server" Height="350px" Width="400px" AutoGenerateColumns="False"> <Columns> <ig:TemplateDataField Key="TemplateField_0"> <ItemTemplate> <asp:Button ID="Button1" runat="server" OnClientClick="getCellValue()" Text="Button" /> </ItemTemplate> <Header Text="TemplateField_0"> </Header> </ig:TemplateDataField> <ig:BoundDataField DataFieldName="test" Key="test"> <Header Text="BoundColumn_0"> </Header> </ig:BoundDataField> <ig:BoundDataField DataFieldName="test1" Key="test1"> <Header Text="BoundColumn_0"> </Header> </ig:BoundDataField> </Columns> <Behaviors> <ig:Activation> </ig:Activation> </Behaviors> </ig:WebDataGrid> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </asp:Content>
what do you this the problem is? working fine without the master page, not working with a master page!! which means inside the ContentPlaceHolder not working!
Usually, this exception is thrown when the find function can not find the WebDataGrid with the specified name.Please make sure that the ID property of WebDataGrid corresponds to the passed argument:
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="400px" Width="600px" CssClass="wdg" AutoGenerateColumns="False">
I run the sample using 2018.2 service release and it works as expected.
In case you are still experiencing after verifying that the id is correct, my suggestion is to modify the sample I have provided so that it replicates the behavior and send it back to me for further investigation.