Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have the list in which the name of the columns are available.Now i want to add the values in the list as a columns to the grid. the values in the list is changes.I used the below code
C#
foreach (SpGetExamTypeCourses_Result objCourse in lstCourses)
{
    TemplateField col = new TemplateField();
    col.HeaderText = objCourse.CourseName;
    gvSubwisePerformance.MasterTableView.Columns.Add(col);
}

can anyone help me?
Posted
Updated 22-Dec-14 22:56pm
v2
Comments
Member 11099119 27-Dec-14 6:24am    
i got the columns and my grid view is binding successfully in first postback event but if again the post back occurs the gridview is not visible
can any one help me?

Hello,

Please have a look at this[^] thread on Telerik forums.

Regards,
 
Share this answer
 
Comments
Member 11099119 27-Dec-14 6:25am    
dynamic grid view loses binding when post back occurs ?

I have a dynamic grid View with template fields and bound fields as columns

for the first page load all binding looks fine.values are populated in all columns

when I trigger an event such as selected index changed in Drop downlist present in the column header(inside template field ) the binding are lost and the event is never catched.

how to retain controls when post back occurs and how to resolve this problem ?
Check my Article to add Temnplate Column Dynamically to Telerik radGrid.Hope my article will help you.

Telerik RadGrid Helper Class for ASP.NET[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900