473,379 Members | 1,312 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,379 software developers and data experts.

Tied Up In Knots ASP.NET DataGrid

This may or may not be a simple problem to solve, but to me its seesm
complex, so I will try and be as succinct as possible.

The Scenario
-------------
I am using a DataGrid to display data from different table stored in an SQL
Database. Depending on the Table, I bind the data to the grid which
successfly allows me to display and edit the contents. So far so good.
However, I want to be able to alter the css styles for the header depending
on the table due to widths etc.

Now presently the grid is set to allow the columns to be built
automatically, and this works ok, the only problem is that those columns are
not available programatically as they are built on the fly when the page is
redered. So you think to yourself OK, we will add the bound columns
programatically and set things like the DataField, Header.cssClass etc etc.
Right this works fine for display, but as soon as you want to PostBack, then
you get into difficulty, because when you add the bound columns
programatically, you loose the items you sent during postback.

I have tried saving the column collection and then re-instatingi it during
postback, but you lose the data originallysent back, and so cannot access
any controls in the cells etc.

Im sure someone must have solved this, any help would be appreciated.
Many Thanks
Sep 6 '07 #1
0 1157

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: allyn44 | last post by:
HI--what I am trying to do is 2 things: 1. Open a form in either data entry mode or edit mode depending on what task the user is performing 2. Cancel events tied to fields on the form if I am in...
2
by: hartbypass | last post by:
Trying to determine the best way to do this. I have a table that has about 16 columns of free form text and one column that needs to be updated by an enduser. Instead of trying to put the data in...
3
by: Engineerik | last post by:
The vb6 datagrid had a "button" property which I used to display a dropdown icon in a cell. I created a popup menu that would display the list of valid choices for that cell when the user clicked...
1
by: Brian Henry | last post by:
If I have two tables in a data set say like this Table1 ====== ItemID Name Table2 =======
4
by: Hexman | last post by:
I was going along fine in my test to see how to manipulate the DataGrid (dgTrans) and its columns. I have a single form with one DataGrid (dgTrans) on it. The code I have in my form load event...
0
by: Jeffy210 | last post by:
I don't know if what i'm asking for is even possible, but I'll give it a shot. Is there a reason why components are tied to forms rather than tied to the project. I can see something like a...
0
by: CoreyWhite | last post by:
In any kind of communication and language, even in computer programming. We can see a difference between total spaghetti and celtic knot work. But it is easy to confuse the two, because sometimes...
0
by: massenza | last post by:
All, Still a newbie, could someone help me out with this. When I load/Open my form my comboboxes which are tied to datasets all have the first value of the dataset listed in the text area of the...
3
by: Question123 | last post by:
Hello I have a .Net 2.0 site and am investigating caching. Using the OutputCache directive seems to work well but there is one thing I am unsure of. Consider two website users UserA & UserB. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.