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

Select a RadGrid Row (Client-side) inside RadWindows

11 Answers 751 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Luciano Kaesemodel
Top achievements
Rank 1
Luciano Kaesemodel asked on 17 Apr 2009, 06:04 PM
Hello!
I have a RadGrid inside of RadWindow...
I need to select a Radgrid row in clientside...
How can I do that? 

I´m trying to get the radgrid like that: 
var masterTable = $find("<%=radgridID.ClientID%>").get_masterTableView();

but always getting null... 

Any help?


11 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Apr 2009, 08:03 AM
Hello Luciano,

Try out the following client side code for selecting the row of Radgrid which is placed in RadWindow.

ASPX:
 
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">  
    <Windows> 
        <telerik:RadWindow ID="RadWindow1" runat="server" VisibleOnPageLoad="true" NavigateUrl="Window1.aspx" > </telerik:RadWindow> 
    </Windows> 
</telerik:RadWindowManager> 
<input id="Button1" type="button" value="button" onclick="selectRow();" /> 

JavaScript:
 
<script type="text/javascript">  
function selectRow()  
{  
    var oManager = GetRadWindowManager();  
    var oWnd = oManager.GetWindowByName("RadWindow1");     
    var grid = oWnd.GetContentFrame().contentWindow.$find('RadGrid1'//Get reference to RadGrid  
    var masterTable = grid.get_masterTableView();  
    masterTable.selectItem(3);  //Select 4th row  
}  
</script> 

Thanks,
Princy.
0
Luciano Kaesemodel
Top achievements
Rank 1
answered on 22 Apr 2009, 01:57 PM
Thanks Princy...

But oWnd.GetContentFrame() is returning null

Any idea?


0
Luciano Kaesemodel
Top achievements
Rank 1
answered on 22 Apr 2009, 02:50 PM
I got it to work... My problem...

But now I have another question...
I need to select a row based on ID setted... 
Other problem is that I have a Radgrid with several pages, so I have to select determined row, and select that page as well...
0
Iana Tsolova
Telerik team
answered on 22 Apr 2009, 03:07 PM
Hello Luciano,

Please check out this code library and try the attached sample in order to achieve your goal.

Let me know if you need further directions/help.

Sincerely yours,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Luciano Kaesemodel
Top achievements
Rank 1
answered on 22 Apr 2009, 04:13 PM
Thanks, but my problem is different...

With Princy code, I can get my gridview :

{  
    var oManager = GetRadWindowManager();  
    var oWnd = oManager.GetWindowByName("RadWindow1");     
    var grid = oWnd.GetContentFrame().contentWindow.$find('RadGrid1'//Get reference to RadGrid 
    var masterTable = grid.get_masterTableView();  
    masterTable.selectItem(3);  //Select 4th row  
}  

But now, I need select a row... I have setted Gridview´s ClientDataKeyNames, so I can compare the elements :

var _id =  masterTable.get_dataItems()[_i].getDataKeyValue("ID")
if(_id == __id) 
masterTable.selectItem(_i);

The problem is mastertable only have the elements of my first gridview Page... How can I iterate all elements of my gridview to find the desired one ? In the client side...
0
Luciano Kaesemodel
Top achievements
Rank 1
answered on 23 Apr 2009, 01:09 PM
Any help?

Thanks
0
Iana Tsolova
Telerik team
answered on 24 Apr 2009, 02:11 PM
Hello Luciano,

I am afraid that you could not iterate through all database records client side. I suggest that you do t on the server as shown in the provided sample.

Kind regards,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Luciano Kaesemodel
Top achievements
Rank 1
answered on 24 Apr 2009, 03:19 PM
Ok, but I can iterate only rows from current page. How can I iterate all rows (from all pages) ?

Thanks
0
Iana Tsolova
Telerik team
answered on 27 Apr 2009, 09:54 AM
Hi Luciano,

You will need to iterate through the grid data source records in this case as it is done in the sample I previously sent you.

Check it out and let me know if any issues arise.

All the best,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Michael Rivera
Top achievements
Rank 1
answered on 24 Aug 2010, 04:13 PM

PREBEN ESTO.....!!!

HABER COMO LES BA....

var grid = $find("<%=grdList.ClientID %>");

 

var firstDataItem = grid.get_masterTableView().get_dataItems()[grid._selectedIndexes[0]];

 

var keyValues = firstDataItem.getDataKeyValue("id_estadoreq");

alert(keyValues);

 

0
Bhavesh
Top achievements
Rank 2
answered on 06 Nov 2012, 11:08 AM

Select a RadGrid Row (Client-side) using javaScript i put CheckBox in RadGrid In one Collumn

When I checked CheckBox RadGrid Row Was Selected Using javaScript In ClientSide

like Event OnCheckedChanged

Tags
Grid
Asked by
Luciano Kaesemodel
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Luciano Kaesemodel
Top achievements
Rank 1
Iana Tsolova
Telerik team
Michael Rivera
Top achievements
Rank 1
Bhavesh
Top achievements
Rank 2
Share this question
or