Hi,
I have a Rad grid and Client side, I am trying to retrieve the value of a cell in Javascript.
I followed the following example, to try and get it to work.
http://www.telerik.com/help/aspnet-ajax/grdgettingcellvaluesforselectedrowsclientside.html
However, I get the following javascript error when selecting the grid row and trying to get the innerHTML value.
"Microsoft JScript runtime error: 'getCellByColumnUniqueName(...).innerHTML' is null or not an object"
Following is the markup for the Grid:
I have a Rad grid and Client side, I am trying to retrieve the value of a cell in Javascript.
I followed the following example, to try and get it to work.
http://www.telerik.com/help/aspnet-ajax/grdgettingcellvaluesforselectedrowsclientside.html
However, I get the following javascript error when selecting the grid row and trying to get the innerHTML value.
"Microsoft JScript runtime error: 'getCellByColumnUniqueName(...).innerHTML' is null or not an object"
Following is the markup for the Grid:
| <telerik:RadGrid ID="RadGridMapFilter" runat="server" AllowPaging="True" AllowMultiRowSelection="True" ClientSettings-EnablePostBackOnRowClick="false" ShowHeader="true" |
| PagerStyle-Mode="Slider" GridLines="Horizontal" |
| Width="377px" AutoGenerateColumns="False" Height="320px" ClientSettings-ClientEvents-OnRowSelected="RowSelected" ClientSettings-ClientEvents-OnRowClick="RowClickPeerGrid" > |
| <MasterTableView> |
| <columns> |
| <telerik:GridBoundColumn DataField="FilterAbb" HeaderText="Filters" |
| SortExpression="Filters" Visible="false" /> |
| <telerik:GridBoundColumn DataField="FilterName" HeaderText="Filters" |
| SortExpression="Filters" Visible="true" /> |
| </columns> |
| <RowIndicatorColumn Visible="False"> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn Resizable="False" Visible="False"> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <EditFormSettings> |
| <PopUpSettings ScrollBars="None" /> |
| </EditFormSettings> |
| </MasterTableView> |
| <ClientSettings> |
| <Selecting AllowRowSelect="True" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
and following are the two javascript functions:
| function RowSelected(sender, eventArgs) |
| { |
| var dataItem = $get(eventArgs.get_id()); |
| var grid = sender; |
| var MasterTable = grid.get_masterTableView(); |
| var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()]; |
| var cell = MasterTable.getCellByColumnUniqueName(row, "FilterAbb").innerHTML;; |
| //var strRowValue = cellinnerHTML; |
| //here cell.innerHTML holds the value of the cell |
| alert(cell); |
| } |
| function GetSelectedNames() |
| { |
| var grid = $find("<%=RadGridMapFilter.ClientID %>"); |
| var MasterTable = grid.get_masterTableView(); |
| var selectedRows = MasterTable.get_selectedItems(); |
| for (var i = 0; i < selectedRows.length; i++) |
| { |
| var row = selectedRows[i]; |
| var cell = MasterTable.getCellByColumnUniqueName(row, "FilterAbb") |
| alert(cell.innerHTML); |
| //here cell.innerHTML holds the value of the cell |
| } |
| } |
Any help would be appreciated.
Thank you,
Anshul.