I've got a hierarchical grid with one DetailTable. The RadGrid is auto-generating an ExpandCollapseColumn on the left, and I'd really like to either move it so it's the rightmost column, or prevent it from being generated so I can just declare my own. Is there any way to do either of these?
4 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 30 Jun 2009, 06:07 AM
Hello Chris,
The best approach would be to hide the autogenerated expand column and create your custom column:
aspx:
Thanks
Princy.
The best approach would be to hide the autogenerated expand column and create your custom column:
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) |
{ |
if (e.Column.UniqueName == "ExpandColumn") |
{ |
e.Column.Display = false; |
} |
} |
aspx:
<telerik:GridExpandColumn ButtonType="ImageButton" CollapseImageUrl="../Image1.bmp" ExpandImageUrl="../Image2.bmp"> |
</telerik:GridExpandColumn> |
Thanks
Princy.
0

nitesh monga
Top achievements
Rank 1
answered on 30 Aug 2009, 09:01 PM
Dear Princy, thanks for the help you provided. it helped me also with the same problem. there is one more issue i am facing, the approach you explain hides the expandcollapasecolumn for the mastertable but if i try to hide the expandcollapasecolumn for the detail table it just not work and i still get the auto genrated expandcollapasecolumn.
Can you please help me out on this, any example will be a great help.
Thanks
Nitesh Monga
Can you please help me out on this, any example will be a great help.
Thanks
Nitesh Monga
0

Princy
Top achievements
Rank 2
answered on 31 Aug 2009, 05:09 AM
Hello Nitesh,
The above code could be used to hide all the expand columns in your grid regardless of which ownertableview it actually belongs to. I tried the same and it worked as expected. I also tried the following code to hide the expand column for a specific gridtableview using its name property. Can you check if this triggers fine for you?
aspx:
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="Sqldatasource1"> |
<MasterTableView Name="Master" HierarchyDefaultExpanded="true" DataSourceID="Sqldatasource1"> |
<DetailTables> |
<telerik:GridTableView HierarchyDefaultExpanded="true" DataSourceID="Sqldatasource2" Name="Detail" runat="server"> |
c#:
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) |
{ |
if (e.Column.Owner.Name == "Detail" && e.Column.UniqueName == "ExpandColumn") |
{ |
e.Column.Display = false; |
} |
} |
-Princy.
0

nitesh monga
Top achievements
Rank 1
answered on 31 Aug 2009, 07:10 PM
Dear Princy,
Thanks Allot it worked :). now i am facing a very strange problem with the images of expandCollapseColumn. as you explained i added the telerik:GridExpandColumn with the imageurl pointing to my images, my grid HierarchyLoadMode is Set to Client, now what is happening once i click on the Expand Plus image the grid expand and somehow the path to the images are lost it starts showing that X sign when we have the missing image, the interesting part is if the HierarchyLoadMode is set to ServerBind the images path are always intact.
I hope i am able to explain my problem,
Thanks & Regards
Nitesh Monga
Thanks Allot it worked :). now i am facing a very strange problem with the images of expandCollapseColumn. as you explained i added the telerik:GridExpandColumn with the imageurl pointing to my images, my grid HierarchyLoadMode is Set to Client, now what is happening once i click on the Expand Plus image the grid expand and somehow the path to the images are lost it starts showing that X sign when we have the missing image, the interesting part is if the HierarchyLoadMode is set to ServerBind the images path are always intact.
I hope i am able to explain my problem,
Thanks & Regards
Nitesh Monga