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

RADGrid columns display issue

3 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AG
Top achievements
Rank 1
AG asked on 10 May 2011, 01:22 PM
Hi

I am adding columns from codebehind. there are some hidden columns and some columns are visible. When we display a hidden column and then do sorting etc , the particular column hides back again as we are rebinding the datagrid on page load. Is there any where to persist the display of columns ?

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 May 2011, 01:40 PM
Hello AG,

I am not quite sure from where you have added the columns. When generating a grid in the Page_Init event handler, grid columns should be added to the Controls collection of the MasterTableView after their attributes are set. Check out the following help article for more on this.
Programmatic creation.

Please elaborate your scenario if it doesn't help.

Thanks,
Princy.
0
AG
Top achievements
Rank 1
answered on 10 May 2011, 01:48 PM
Hi Princy ,

Thanks for prompt reply !


This is roughly what i am doing for creation


protected void Page_Load(object sender, EventArgs e)

 

{

 

 

if (!IsPostBack)

 

 

{

 

 

 

CommonCDRCls<Object, string>.CurrentForm = this;

 

 

 

 

CommonCDRCls<Object, string>.SetCommonSettings();

 

 

}

 

 

 

this.gridControl.Rebind();

 

 

}

 

 

 

/// <summary>

 

 

 

/// Creates grid columns

 

 

 

/// </summary>

 

 

 

/// <param name="sender"></param>

 

 

 

/// <param name="e"></param>

 

 

 

protected void Page_Init(object sender, EventArgs e)

 

 

{

 

LoadGridColumns();

 

}

 


LoadGridColumns is creating columns at backend

0
Tsvetina
Telerik team
answered on 13 May 2011, 06:55 AM
Hello,

If your grid is declared in mark-up you should create its columns on initial Page_Load, instead of on Page_Init. Also, as said in the other forum thread that you have opened, rebinding is not needed in Page_Load, since RadGrid will fire its NeedDataSource event automatically in this case.

In case after making these changes, some of the issues persist, please write in the other forum thread, so that we avoid double posting.

Greetings,
Tsvetina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
AG
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
AG
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or