3 Answers, 1 is accepted
0
andy
Top achievements
Rank 1
answered on 03 Sep 2008, 06:13 PM
var selecteditem = $find("<%= RadGrid1.MasterTableView.ClientID %>").get_selectedItems();
for (var i=0; i < selecteditem.length; i++)
{
alert(selecteditem[i].getDataKeyValue('myKey'));
}
for (var i=0; i < selecteditem.length; i++)
{
alert(selecteditem[i].getDataKeyValue('myKey'));
}
0
Kevin Babcock
Top achievements
Rank 1
answered on 03 Sep 2008, 06:29 PM
Hello Steve,
You can use the RadGrid's client-side API to retrieve its selected rows. First you need to enable client-side row selecting by setting the AllowRowSelect property to true in the <ClientSettings> of your RadGrid. Then call the get_selectedItems() function of your client-side MasterTableView object somewhere in JavaScript to get an array of the selected row's GridDataItems, which you can use for further processing. Here is a quick example:
I hope this helps. If you have further questions, please don't hesitate to ask.
Regards,
Kevin Babcock
You can use the RadGrid's client-side API to retrieve its selected rows. First you need to enable client-side row selecting by setting the AllowRowSelect property to true in the <ClientSettings> of your RadGrid. Then call the get_selectedItems() function of your client-side MasterTableView object somewhere in JavaScript to get an array of the selected row's GridDataItems, which you can use for further processing. Here is a quick example:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> | |
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> | |
<script type="text/javascript"> | |
function Click() { | |
var tableView = $find('<%= RadGrid1.ClientID %>').get_masterTableView(); | |
var selectedItems = tableView.get_selectedItems(); | |
var count = selectedItems.length; | |
for (var i = 0; i < count; i++) { | |
var dataItem = selectedItems[i]; | |
// do something | |
} | |
} | |
</script> | |
</telerik:RadScriptBlock> | |
<telerik:RadGrid ID="RadGrid1" runat="server" AllowMultiRowSelection="true" | |
OnNeedDataSource="RadGrid1_NeedDataSource"> | |
<ClientSettings> | |
<Selecting AllowRowSelect="True" /> | |
</ClientSettings> | |
</telerik:RadGrid> | |
<asp:Button ID="Button1" runat="server" | |
Text="Click Me!" | |
OnClientClick="Click(); return false;" /> |
I hope this helps. If you have further questions, please don't hesitate to ask.
Regards,
Kevin Babcock
0
Shinu
Top achievements
Rank 2
answered on 04 Sep 2008, 05:45 AM
Hi Steve,
You can also go through the following help article which explains on this regard.
Getting cell values for selected rows client side
Thanks
Shinu
You can also go through the following help article which explains on this regard.
Getting cell values for selected rows client side
Thanks
Shinu