I have a radgrid.
<
Columns>
<telerik:GridTemplateColumn HeaderText="SlNo">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Font-Bold="true" Width="4%" />
<ItemStyle HorizontalAlign="Center" Width="4%" />
<ItemTemplate>
<%
# this.rgByAirline.CurrentPageIndex * this.rgByAirline.PageSize + Container.ItemIndex + 1%>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="Recipe_Id" HeaderText="Recipe_Id" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Recipe">
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Middle" Font-Bold="true" Width="96%" />
<ItemStyle HorizontalAlign="Left" Width="96%" />
<ItemTemplate>
<asp:LinkButton ID="lnkRecipe" runat="server" ToolTip="Click here to see details of the Recipe"
CommandName="PopupWindow" OnClientClick="return PopupWindow(this);" Text='<%#Eval("Recipe_Description") %>'></asp:LinkButton>
<asp:Label ID="ltrRecipeId" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem,"Recipe_Id") %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
I want to get the Recipe_Id in the javascript PopupWindow(this);
function PopupWindow(anc) {
debugger;
var rowIndex = anc.parentElement.parentElement.rowIndex;
var grdRowNo = Number(isNaN(rowIndex) ? 0 : rowIndex) + 1;
var strTransLblId = 'ctl00_CphMaster_rgByAirline' + ((grdRowNo <= 9) ? '_ctl00_ctl0' : '_ctl00_ctl') + grdRowNo + '_ltrRecipeId';
var intRecipeId = Number(document.getElementById(strTransLblId).innerText);
var oWnd = radopen("FKMS_MMS_Recipe_Detail_Popup.aspx?intRecipeId=" + intRecipeId, "RadWindowPopup");
oWnd.setSize(725, 600);
return false;
}
I got the row number correctly.
But it shows null reference exception in the following line.
var intRecipeId = Number(document.getElementById(strTransLblId).innerText);
Please help urgently.