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

Dynamic Columns Doubling Up

2 Answers 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 20 Nov 2008, 04:54 AM
I have a grid that has dynamic columns created. However whenever any server side event is fired such as paging the columns are doubled up but seemingly without datafield information. The routine that creates the dynamic columns is not being called twice after the Postbacks. An example of what it looks like is here. http://www.jobtree.com.au/images/grid.gif


2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Nov 2008, 06:25 AM
Hello Craig,

 If you are creating your columns on the initial page load, then you can do a check for Page.IsPostBack so that you don't add the columns twice on postback.
cs:
protected void Page_Load(object sender, EventArgs e) 
    { 
      if ( !IsPostBack ) 
        {    
          //Code to create columns 
   
        }     
    } 

Thanks
Princy.
0
Craig
Top achievements
Rank 1
answered on 20 Nov 2008, 09:51 AM
Thanks, I am checking IsPostback so that is not the problem. Also, if you look at the image you will see the extra columns are not exact duplicates because they appear to have no data field info (see image).
Tags
Grid
Asked by
Craig
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Craig
Top achievements
Rank 1
Share this question
or