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

DetailTables

1 Answer 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sridevi
Top achievements
Rank 1
Sridevi asked on 25 Nov 2008, 05:22 PM

Hi,
when we are using client side binding of DetailTables in RaDgrid following issues we found

1.Unable toassign multiple datakeynames for ClientDataKeyNames, when we tried its throwing error
2. Unable to Hide and show the Expand and Collpase buttons on RadGrid1_ItemDataBound
3. Unable to find the control in the detailtables

Thanks,
Sridevi.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Nov 2008, 07:21 AM
Hi Sridevi,

I hope you are adding the detail tables declaratively in the aspx page. If so:

1. You can set multiple ClientDataKeyNames and access it on the client side.

  ASPX:
 <MasterTableView DataSourceID="SqlDataSource1"  EditMode="inplace"  ClientDataKeyNames="ProductName,ProductID" > 
                  
 
JS:
<script type="text/javascript" > 
   
  function OnRowClick() 
  { 
   var firstDataItem = $find("RadGrid1").get_masterTableView().get_dataItems()[0]; 
   var keyValue1 =   firstDataItem.getDataKeyValue("ProductName"); 
   var keyValues2 =   firstDataItem.getDataKeyValue("ProductID"); 
     alert(keyValue1) 
     alert(keyValues2) 
  } 
</script> 

2. You can hide the Expand/Collapse column of the Grid in the ColumnCreated event.

 CS:
 
 protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) 
    { 
        if (e.Column is GridExpandColumn) 
        { 
            e.Column.Display = false
        } 
    } 

3. You can refer the following help article which explains on how to access detail tables in the code behind.
  Traversing detail tables/items in Telerik RadGrid


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