Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > GridView.Columns.Insert Problems

Reply
Thread Tools

GridView.Columns.Insert Problems

 
 
Harry Keck
Guest
Posts: n/a
 
      02-09-2007
I have a GridView that I dynamically add columns to in code. The way that my
code is written, everything works properly if I use GridView.Columns.Add to
simply add the columns to the end of the collection. However, if I use
GridView.Columns.Insert to inject the columns in the middle of the existing
columns, I see lots of exceptions when I page the GridView, because certain
controls contained within the grid are mysteriously absent? Can anyone
explain what the difference is between Add and Insert that would cause
problems?
 
Reply With Quote
 
 
 
 
Harry Keck
Guest
Posts: n/a
 
      02-09-2007
I think I can see what is happening, but I still do not know why. My
GridView has a number of TemplateFields declared directly in the aspx. I
then use GridView.Columns.Insert to add a couple of BoundFields to the grid.
Any subsequent time that I bind data to the GridView after calling Insert,
all of the TemplateFields are empty. If I change my code to use Collumns.Add
in place of Collumns.Insert, the Template Fields do not empty. What is going
on?

"Harry Keck" wrote:

> I have a GridView that I dynamically add columns to in code. The way that my
> code is written, everything works properly if I use GridView.Columns.Add to
> simply add the columns to the end of the collection. However, if I use
> GridView.Columns.Insert to inject the columns in the middle of the existing
> columns, I see lots of exceptions when I page the GridView, because certain
> controls contained within the grid are mysteriously absent? Can anyone
> explain what the difference is between Add and Insert that would cause
> problems?

 
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
Saving the web, charset problems and symbols problems Sak Na rede Ruby 0 01-30-2009 05:05 AM
Problems, problems for newbie Shelly ASP .Net 1 09-03-2007 02:10 AM
Problems compiling simple C++ code (also problems with std::string) Susan Baker C++ 2 06-26-2005 01:43 AM
Re: sound problems and modem problems Harold Potter Computer Support 5 12-04-2003 04:12 PM



Advertisments