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

CLientSide Popup Pass Id from CommandItemTemplate

1 Answer 23 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 27 Oct 2008, 04:34 PM
Hello,

I am trying to Select a Row in the grid then Click on a Button in the CommandItemTemplate to run JavaScript to do the following.

Open Rad WIndow to a Page and Passing the Value from the DataKeyNames of the selected row to the new page.

Any insight will be helpfuul.

Jim

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Oct 2008, 05:14 AM
Hi Jim,

Try the following code snippet to achieve the desired scenario.

ASPX:
<CommandItemTemplate> 
     <asp:Button ID="Button3" runat="server" Text="Button" OnClientClick="Open();"  /> 
 </CommandItemTemplate> 


JS:
function Open( ) 
  var grid = $find("<%=RadGrid1.ClientID %>"); 
   var MasterTable = grid.get_masterTableView(); 
 
   var selectedRows = MasterTable.get_selectedItems(); 
   for (var i = 0; i < selectedRows.length; i++) 
   { 
     var row = selectedRows[i]; 
     var keyValues =   row.getDataKeyValue("CategoryID"); 
     alert(keyValues) 
     window.radopen("CategoryID=" + keyValues, "Window1"); 
     return false;  
   } 


Thanks
Shinu.
Tags
Grid
Asked by
Jim
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or