views:

42

answers:

1

Hey there everyone, 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 day and a half!

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".

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 is my current JavaScript and a stripped down radGrid:

 ///Javascript///

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 + "&SkinSrc=[G]Skins/Blue-NCPP/Plain&BIDs=" + id, "RadWindow3");
    }
A: 
var grid = $find("<%=perDiemBookingsRadGrid.ClientID%>")

Then you can loop through the rows in grid.MasterTableView.SelectedRows and get the values

for(var i = 0; i < grid.MasterTableView.SelectedRows.length; i++)
{
    var selectedRow = grid.MasterTableView.SelectedRows[i];
    var id = selectedRow.KeyValues["BookingID"];
    //code to do stuff here.
}
Ed B
cmmitw
function ShowEditForm() {var tab = gup('TabID')var mid = gup('mid').replace(/#/, '')var grid = $find("<%=perDiemBookingsRadGrid.ClientID%>") for (var i = 0; i < grid.MasterTableView.SelectedRows.length; i++) { var selectedRow = grid.MasterTableView.SelectedRows[i]; var id = selectedRow.KeyValues["BookingID"]; //code to do stuff here. window.radopen("/Default.aspx?TabID=" + tab + "}}
cmmitw
Ed B