sorry for bothering, but I've a few problems with the programmatic creation of columns in rad grid.
I start from the scenario that for me it would be perfect because I'd like to understand how far the grid is from it:
- should be possible to create the columns of the grid in the page_load (when IsPostBack == false)
- the dynamic columns should be of type Template
- during the event phase of the page (basically when a user clicks a button) it should be possible to clear the old columns and create new ones.
I've looked to this example
where you attach columns dynamically on the onload of the page. That works with simple columns, but fails with templated columns.
For precision's sake, I'm using NeedDataSource event, but on postbacks the InstantiateIn method of the templates is not called.
Is there any way to force it on postbacks?
Should I use the simple DataBind approach?
I've also tried creating the columns in the oninit (I underline the fact that I don't like it very much, because OnInit is a very early phase of the control lifecycle. Many informations could not be there for deciding which column instantiate).
I was able to create both simple and template columns, but I had to do one of these choices:
1. Check if IsPostBack == false and leave EnableColumnsViewState == true
2. Don't check the IsPostBack property and set EnableColumnsViewState = false
Which is the correct approach?
May you give some advice on how to fulfill my scenario?
Best regards, Andrea Pirola