I'm hoping there is a simple fix for this, but I would accept a complicated one after messing around with it for the last week!
I am putting together a module that will drop into a DotNetNuke portal and I'm populating a Telerik RadGrid with data. I have followed every tutorial and example I can find, but the result keeps coming back with "object Object", "null", or "undefined" when I try to get the value of a cell in the selected rows.
I need to:
1) get the value of the "BookingID'" column for each row that is selected
2) pass the value into a url string that opens up in a RadWindow.
I'm trying to do all of this using javascript, but if you know a better way, I'm down for anything at this point.
Here are some of the tutorials and examples I have followed to no avail:
http://stackoverflow.com/questions/761633/select-a-radgrid-row-client-side-inside-radwindows
http://www.telerik.com/help/aspnet/grid/grdgettingcellvaluesforselectedrowsclientside.html
http://www.telerik.com/community/forums/aspnet-ajax/grid/extracting-cell-values-from-radgrid.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/client/selecting/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/grid/examples/client/keys/defaultcs.aspx
Here is my current JavaScript and a stripped down radGrid:
I am putting together a module that will drop into a DotNetNuke portal and I'm populating a Telerik RadGrid with data. I have followed every tutorial and example I can find, but the result keeps coming back with "object Object", "null", or "undefined" when I try to get the value of a cell in the selected rows.
I need to:
1) get the value of the "BookingID'" column for each row that is selected
2) pass the value into a url string that opens up in a RadWindow.
I'm trying to do all of this using javascript, but if you know a better way, I'm down for anything at this point.
Here are some of the tutorials and examples I have followed to no avail:
http://stackoverflow.com/q
http://www.telerik.com/hel
http://www.telerik.com/com
http://demos.telerik.com/a
http://demos.telerik.com/a
Here is my current JavaScript and a stripped down radGrid:
| function gup(name) { |
| name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); |
| var regexS = "[\\?&]" + name + "=([^&]*)"; |
| var regex = new RegExp(regexS); |
| var results = regex.exec(window.location.href); |
| if (results == null) return ""; |
| else return results[1]; |
| } |
| function ShowEditForm() { |
| var tab = gup('tabid') |
| var mid = gup('mid').replace(/#/, '') |
| var masterTableView = $find("perDiemBookingsRadGrid").get_masterTableView(); |
| var id = masterTableView.get_selectedItems()[0].getDataKeyValue('BookingID'); |
| window.radopen("/Default.aspx?tabid=" + tab + "&ctl=multiEdit&mid=" + mid + &BIDs=" + id, "RadWindow3"); |
| } |
| <telerik:RadGrid ID="perDiemBookingsRadGrid" runat="server" AllowPaging="True" AllowSorting="True" |
| DataSourceID="perDiemBookingsSqlDataSource" GridLines="None" ShowGroupPanel="True" |
| AllowAutomaticDeletes="True" AllowMultiRowSelection="True" Width="800px" AllowAutomaticUpdates="True" |
| AutoGenerateColumns="False" > |
| <MasterTableView DataSourceID="perDiemBookingsSqlDataSource" DataKeyNames="BookingID" |
| CommandItemDisplay="Top"> |
| <CommandItemTemplate> |
| <div style="padding: 5px 5px;"> |
| <a href="#" onclick="return ShowEditForm();" visible='<%# perDiemBookingsRadGrid.EditIndexes.Count = 0 %>'> |
| <img style="border: 0px; vertical-align: middle;" alt="" src="/images/Edit.gif" /> |
| Show Edit Form</a> |
| </div> |
| </CommandItemTemplate> |
| <Columns> |
| <telerik:GridClientSelectColumn Reorderable="False" Resizable="False" ShowSortIcon="False" |
| UniqueName="column"> |
| </telerik:GridClientSelectColumn> |
| <telerik:GridBoundColumn DataField="BookingID" UniqueName="BookingID" DataType="System.Int32" |
| HeaderText="BookingID" ReadOnly="True" SortExpression="BookingID" Visible="False"> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn DataField="CustomerName" HeaderText="Customer" UniqueName="Customer" |
| EditFormColumnIndex="2" GroupByExpression="GROUP BY CustomerName" SortExpression="CustomerName"> |
| <EditItemTemplate> |
| </Columns> |
| <EditFormSettings ColumnNumber="3"> |
| <EditColumn UniqueName="EditCommandColumn1"> |
| </EditColumn> |
| </EditFormSettings> |
| </MasterTableView> |
| <ClientSettings AllowDragToGroup="True"> |
| <Selecting AllowRowSelect="True"/> |
| </ClientSettings> |
| </telerik:RadGrid> |