471,312 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,312 software developers and data experts.

Gridview dynamic columns

I'm modifying someone else's code and I have hit a snag. I don't
want
to rewrite what's already there but I might have to.

I have a gridview, in the gridview is a set number of columns that
will always be there. On the end of the gridview I need to add
columns
dynamically. These columns may or may not exist and I don't know how
many there will be. The way it is currently programmed, there are 2
gridviews, one for viewing a list and one for editing the list. So
the gridview is either being editted or it's being viewed. The way
the editted gridview is saved is by looping through each row, finding
the value in certain controls, and saving a list generated with the
values extracted.
Here's the problem, I can add and view columns in both gridviews by
adding new table cells to each row, but when I go to extract the
values within the code of the process described above, the gridview
doesn't have the additional columns. My question is, how do I add a
control to a gridview after it has been bound and then extract the
value from it? I'd prefer to not rewrite what's already there and
working, but is there an easier or better way to accomplish the same
goal? Thank you for your help in advance.
Apr 9 '08 #1
1 2640
Jimmy,
A GridView is an ASP.NET control, this is the C# language group. I think
you'll get a better response in the ASP.NET newsgroup.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"jimmysjams" wrote:
I'm modifying someone else's code and I have hit a snag. I don't
want
to rewrite what's already there but I might have to.

I have a gridview, in the gridview is a set number of columns that
will always be there. On the end of the gridview I need to add
columns
dynamically. These columns may or may not exist and I don't know how
many there will be. The way it is currently programmed, there are 2
gridviews, one for viewing a list and one for editing the list. So
the gridview is either being editted or it's being viewed. The way
the editted gridview is saved is by looping through each row, finding
the value in certain controls, and saving a list generated with the
values extracted.
Here's the problem, I can add and view columns in both gridviews by
adding new table cells to each row, but when I go to extract the
values within the code of the process described above, the gridview
doesn't have the additional columns. My question is, how do I add a
control to a gridview after it has been bound and then extract the
value from it? I'd prefer to not rewrite what's already there and
working, but is there an easier or better way to accomplish the same
goal? Thank you for your help in advance.
Apr 9 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by NateDawg | last post: by
reply views Thread by jeffmagill | last post: by
4 posts views Thread by Ken Wigle | last post: by
1 post views Thread by spitapps | last post: by
4 posts views Thread by Yin99 | last post: by
4 posts views Thread by Craig Buchanan | last post: by
reply views Thread by Craig Buchanan | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.