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

Dynamic Template column Problem

3 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sumanth
Top achievements
Rank 1
Sumanth asked on 12 Oct 2010, 08:41 AM
Hi,
As per my requirement, i need to create template column programmatically (I don't know columns of data source at design time).
Am able to add template columns programmatically but data in columns lost in postbacks.
To overcome this, i moved columns adding logic to OnInit event, but same set of columns are adding again and again between postbacks.
I tried

gv1.MasterTableView.Columns.Clear(); and gv1.Columns.Clear(); methods but they have not worked for me.

Please help me to fix this. Sample code will be greatly appreciated.

Thanks,
Sumanth

 


3 Answers, 1 is accepted

Sort by
0
Accepted
Pavlina
Telerik team
answered on 12 Oct 2010, 10:00 AM
Hi Sumanth,

Try adding the following line and let me know if it helps:
    gv1.MasterTableView.EnableColumnsViewState = false;

You can examine Changing the grid structure dynamically on postback help topic for additional information.

Greetings,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Sumanth
Top achievements
Rank 1
answered on 12 Oct 2010, 10:27 AM
Hi Pavlina,
EnableColumnViewState property works for me. Thank you very much.

Thanks,
Sumanth
0
Pavlina
Telerik team
answered on 12 Oct 2010, 12:25 PM
Hello Sumanth,

I am glad I could help, in case you experience any further problems or you have additional questions, do not hesitate to contact us again.

Kind regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Sumanth
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Sumanth
Top achievements
Rank 1
Share this question
or