Hi
And where should i create the rest of the columns on codebehind? I want to implement a custom autogenerate columns method, where I check a config file for creating columns. Where should i implement this logic? I want to have access to the bound datasource, to check the date type of the bound properties vs my columns.
Thanks beforehand
5 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 19 Jan 2009, 10:37 AM
Hi,
Try the following code snippet in the ColumnCreated event to set the ButtonType of the AutoGenerated edit and delete column.
CS:
Reorder the columns in the server side using the SwapColumns method:
You can dynamically create the columns and add it to the Grid's column collection in the PageLoad event.
Thanks
Shinu.
Try the following code snippet in the ColumnCreated event to set the ButtonType of the AutoGenerated edit and delete column.
CS:
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) |
{ |
if (e.Column.UniqueName == "AutoGeneratedEditColumn") |
{ |
GridEditCommandColumn editcol = (GridEditCommandColumn)e.Column; |
editcol.ButtonType = GridButtonColumnType.PushButton; |
} |
if (e.Column.UniqueName == "AutoGeneratedDeleteColumn") |
{ |
GridButtonColumn btncol = (GridButtonColumn)e.Column; |
btncol.ButtonType = GridButtonColumnType.PushButton; |
} |
} |
Reorder the columns in the server side using the SwapColumns method:
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
RadGrid1.MasterTableView.SwapColumns(2, 9); |
} |
You can dynamically create the columns and add it to the Grid's column collection in the PageLoad event.
Thanks
Shinu.
0
Softec
Top achievements
Rank 1
answered on 20 Jan 2009, 05:31 PM
Hi
I'm now using the OrderIndex Property of the GridColumn Object to reorder my Columns depending on a Config File. This only works if i'm calling SwapColumns afterwards, like this.MasterTableView.SwapColumns(0, 0);
But if im entering InPlace Edit i get NullReferenceException calling the SwapColumns() method.
Do you have any suggestion where the problem lies?
Is this a known bug, especially the part of OrderIndex not working without calling SwapColumns?
0
Scott Eoff
Top achievements
Rank 2
answered on 23 Apr 2009, 05:26 PM
I'm getting the same problem. Did you ever find a solution?
0
Kyle
Top achievements
Rank 1
answered on 29 Apr 2009, 09:51 PM
I would like my auto generated edit column to be to the right of my auto generated grid columns. This sounds like the same issue as this thread. Is this possible to accomplish? I was not able to get it to work by setting order indexes in the column created event. Those seem to be ignored.
Thanks,
Kyle LeMarbe
Thanks,
Kyle LeMarbe
0
Princy
Top achievements
Rank 2
answered on 30 Apr 2009, 03:57 AM
Hello Kyle,
You can reorder the columns using their unique names as shown below:
c#:
Thanks
Princy.
You can reorder the columns using their unique names as shown below:
c#:
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
RadGrid1.MasterTableView.SwapColumns("AutoGeneratedEditColumn","LastColumnUniqueName"); |
// UniqueName for an AutoGenerated column is the same as the DataField |
} |
Thanks
Princy.