Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Added TemplateColumn is not showing in DataGrid after PostBack

Reply
Thread Tools

Added TemplateColumn is not showing in DataGrid after PostBack

 
 
Jade Seguin
Guest
Posts: n/a
 
      07-13-2004
Hello,

Hope somebody can help me with this cause I'm a ASP.NET beginner. I've
created A DataGrid, and I added few BoundedColumns, and in my
Page_Load section I added few TemplateColumns through the
myGrid.Columns.Add(myTemplateColumn). After that I bind the datasource
to the datagrid in the Page_Load only if it is not a postback.
Initially it works fine, but on PostBack (whatever I do on the
webform) my TemplateColumns dissapear Only the BoundedColumns stay.

BTW. the code myGrid.Columns.Add(myTemplateColumn) is not in the If
Not IsPostBack section, so it executes on each postback.

Why doesn't it work? I thought you should only do the bind on the
initial Page_Load and not on each postback, cause to me it seems like
a lot of processing (i.e. database connections etc...)... Should it
not be bound only once like my BoundedColumns which show fine on each
postback?
 
Reply With Quote
 
 
 
 
Saravana [MVP]
Guest
Posts: n/a
 
      07-14-2004
This template columns has to added in datagrid itemcreated event handler and
not in page_load. Since this template columns has to be created during
every post back.

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com



"Jade Seguin" <> wrote in message
news: om...
> Hello,
>
> Hope somebody can help me with this cause I'm a ASP.NET beginner. I've
> created A DataGrid, and I added few BoundedColumns, and in my
> Page_Load section I added few TemplateColumns through the
> myGrid.Columns.Add(myTemplateColumn). After that I bind the datasource
> to the datagrid in the Page_Load only if it is not a postback.
> Initially it works fine, but on PostBack (whatever I do on the
> webform) my TemplateColumns dissapear Only the BoundedColumns stay.
>
> BTW. the code myGrid.Columns.Add(myTemplateColumn) is not in the If
> Not IsPostBack section, so it executes on each postback.
>
> Why doesn't it work? I thought you should only do the bind on the
> initial Page_Load and not on each postback, cause to me it seems like
> a lot of processing (i.e. database connections etc...)... Should it
> not be bound only once like my BoundedColumns which show fine on each
> postback?



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid invisible TemplateColumn dose not generate HTML object? rockdale ASP .Net Datagrid Control 2 06-07-2006 01:31 PM
ASP 1.1: DataGrid - Showing/Not Showing Buttons Ray Booysen ASP .Net 2 03-28-2006 02:49 PM
Postback for DataGrid Columns Added in Code Behind not firing. Pete Mahoney ASP .Net Datagrid Control 1 08-31-2004 07:13 AM
Added TemplateColumn is not showing in DataGrid after PostBack Jade Seguin ASP .Net 2 08-02-2004 09:53 AM
I am adding a new row to the datagrid dynamically but if i use the Count property of Item it is not showing the count of the new rows being added Praveen Balanagendra via .NET 247 ASP .Net 2 06-06-2004 07:16 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57