This is a migrated thread and some comments may be shown as answers.

Javascript unable to find the selected rowID when used in a Master/Content page.

1 Answer 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve Holdorf
Top achievements
Rank 1
Steve Holdorf asked on 11 Dec 2012, 02:00 PM
Here we are attempting to get the DataKeyValue (the ID of the data record) when using the javascript below. This code works fine in a a straigh APSX page but doesn't work in the content page of the Master/Content design.

var rowID;

function RowClick(sender, eventArgs) {
    var radmenu = document.getElementByID('<%= Page.Master.FindControl("MainContent").FindControl("RadGrid1").Client.ID %>');
    if (radmenu.get_masterTableView().get_selectedItem()[0] != null) {
        rowID = radmenu.get_masterTableView().get_selectedItem()[0].getDataKeyValue("ID");
    }
}

<telerik:RadGrid ...
    <ClientSettings>
        <ClientEvent OnRowClick="RowClick"></ClientEvent>

Here I get the for the radGrid.get_masterTableView().get_selectedItem()[0].getDataKeyValue("ID"): The error is: Object doesn't support this property or method.  

Thanks,


Steve Holdorf 

1 Answer, 1 is accepted

Sort by
0
Steve Holdorf
Top achievements
Rank 1
answered on 11 Dec 2012, 05:26 PM
To solve the problem we are using:

eventArgs.getDataKeyValue("ID");

This code is in the javascript RowClick event.

Thanks,


Steve Holdorf
Tags
Grid
Asked by
Steve Holdorf
Top achievements
Rank 1
Answers by
Steve Holdorf
Top achievements
Rank 1
Share this question
or