473,218 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,218 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 2747
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
0
by: jeffmagill | last post by:
Hi Everybody, I'm really hoping that someone can help me out because I have spent too much time on this project already! Basically, I have a DetailsView that handles all the Edits for a...
0
by: H5N1 | last post by:
Hi there It seems I've spotted interesting problem in a job I've got to do. I have 3 tables: meals, employees, and intersecting table: meals_for_employees with bool field meaning, that given...
3
by: BartMan | last post by:
Greetings, I have a gridview which is sitting on a multi view control (witin a view), and it is bound to a dataset which I dynamically apply to the control within asp.net page. The problem is...
4
by: Ken Wigle | last post by:
All, I would be very grateful for any help on this question. I have an application in asp.net 2.0 where I dynamically create a datatable and then bind that to a gridview. Unfortunately, the...
1
by: spitapps | last post by:
In a traditional gridview control the items inserted(bind) into the control are rows and the data is in columns. I have a customer who wants the data fields as rows and the columns as the items...
4
by: Yin99 | last post by:
I have a Gridview binding to a DataTable source. I'd like to set the column with of the second column. I cannot do this apparently because when AutoGenerateColumns=true, they do not appear in the...
4
by: Craig Buchanan | last post by:
I dynamically add data-bound templates to a gridview in my ascx control. while this works correctly when the gridview is databound to the datatable, i'm having issues on postback. i would like...
0
by: Craig Buchanan | last post by:
I am adding templates to a gridview dynamically. these columns are based on data values that are generated prior to calling the gridviews databind. the challenge is when the form does a...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.