I am using the code you guys have posted on this page = http://www.telerik.com/help/aspnet-ajax/grid-getting-cell-values-for-selected-rows-client-side.html . It works great as long as my column is set to visible = true. when I hide the id column the javascript cannot access the value. Is there a solution to this? Basically what I am doing is allowing the user to select the entire row, I then grab the ID column and send them to a reporting page with this ID set as a querystring.
Here is the aspx page code:
Thanks!
Sam
Here is the aspx page code:
<script type="text/javascript" > function RowSelected(sender, eventArgs) { var grid = sender; var MasterTable = grid.get_masterTableView(); var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()]; var cell = MasterTable.getCellByColumnUniqueName(row, "videoID"); window.location = "Map.aspx?id=" + cell.innerHTML; //here cell.innerHTML holds the value of the cell } </script> <style type="text/css" > .RowMouseOver { background-color: red !important; } </style> <table width="900" align="center"><tr><td> <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"> </telerik:RadScriptManager> </td></tr><tr><td align="center"> <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" DataSourceID="sdsVideoList" AllowMultiRowSelection="True" ShowFooter="True" ShowStatusBar="True" AllowSorting="True" CellSpacing="0" GridLines="None" Skin="Telerik" AutoGenerateColumns="False"> <ClientSettings EnableRowHoverStyle="true" > <Selecting AllowRowSelect="true" /> <ClientEvents OnRowSelected="RowSelected" /> </ClientSettings> <MasterTableView><CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings><RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"><HeaderStyle Width="20px"></HeaderStyle></RowIndicatorColumn><ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"><HeaderStyle Width="20px"></HeaderStyle></ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn DataField="videoID" Visible="true" FilterControlAltText="Filter column column" HeaderText="videoID" UniqueName="videoID"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter column1 column" HeaderText="Name" UniqueName="column1"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CreatedOn" FilterControlAltText="Filter column2 column" HeaderText="Date Created" UniqueName="column2"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="wisitaID" Visible="false" FilterControlAltText="Filter column3 column" HeaderText="Wisita ID" UniqueName="column3"> </telerik:GridBoundColumn> </Columns><EditFormSettings><EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn></EditFormSettings></MasterTableView><FilterMenu EnableImageSprites="False"></FilterMenu><HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu> </telerik:RadGrid>Thanks!
Sam