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

Double click in grid

1 Answer 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mona
Top achievements
Rank 1
Mona asked on 29 Sep 2008, 09:54 AM
I'am using Telerik web RadGrid.The Column names are BranchID, Name, Code.
 These are getting set in the RadGrid then what i would like to know is how to set double Click on a cell and then open popup page to display Branch Data with that BranchID details.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Sep 2008, 11:20 AM
Hello Mona,

You can try out the following code to open a window on double click of a cell in a particular column. You have to set BranchID as the DataKeyName of the grid.
aspx:
 <telerik:radgrid id="RadGrid1" AutoGenerateColumns="false" DataSourceID="SqlDataSource1" runat="server" OnItemDataBound="RadGrid1_ItemDataBound" >   
     <MasterTableView DataKeyNames="BranchID" DataSourceID="SqlDataSource1">    
       <Columns>        
        <telerik:GridBoundColumn HeaderText="BranchID" DataField="BranchID" UniqueName="BranchID"></telerik:GridBoundColumn> 
       </Columns>  
     </MasterTableView>       
  </telerik:radgrid> 
 
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"
        </telerik:RadWindowManager> 

cs:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
            dataItem["BranchID"].Attributes["onDblClick"] = String.Format("return DoubleClick('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["BranchID"], e.Item.ItemIndex); 
        } 
    }

js:
 <script type="text/javascript"
  function DoubleClick(id,rowIndex) 
  { 
   
    var grid = $find("<%= RadGrid1.ClientID %>"); 
    var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();                                       
     window.radopen("DetailsForm.aspx?BranchID=" + id, "RadWindow1"); 
       return false;      
  } 
 </script> 

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