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

Lost columns in datagrid

Reg
Hello,

I have a datagrid with a checkbox column created in VS. The user can filter
the data
and obtain a grid (with dimanics columns : AutoGenerateColumns=false) in
which he selects the lines. When he submits the query, the datagrid
contains only the first column. Where are my others columns ???

Thank you for your help
May 10 '06 #1
5 1307
How are the other columns added to the grid? You may need to enable
viewstate for the datagrid, or call the DataBind method to regenerate
the other columns.

May 10 '06 #2
Reg
Hello,

In fact, the user can choose several options of filters what creates a first
datagrid in which I add the columns.
System.Web.UI.WebControls.BoundColumn bc = new BoundColumn();
bc.HeaterText = ........
....
The user obtains the grid with all the data.Then he selects the lines and
with the return I do not have any more the columns...
I will test viewstate.
"JohnH" wrote:
How are the other columns added to the grid? You may need to enable
viewstate for the datagrid, or call the DataBind method to regenerate
the other columns.

May 10 '06 #3
Reg
EnableViewState=true does not give more results :(
I don't understand : when I click on my button, the page sends the datagrid
with the first column (with checkbox correctly set) but the others columns
don't be returned.
Is this because AutoGenerateColumns=false ? However, I have to create my
columns dynamically...
"JohnH" wrote:
How are the other columns added to the grid? You may need to enable
viewstate for the datagrid, or call the DataBind method to regenerate
the other columns.

May 10 '06 #4
Ah, I see. In order for the the "magic" ViewState reconstructor to
work, the BoundColumn definitions must have been added to the DataGrid
before the ViewState is processed, and the ViewState processor has to
be able to find them (the BoundColumns) by ID. So:

1. Add the BoundColumns to the DataGrid in the Page.OnInit method; and
2. Make sure you set the ID of each control in the columns.

HTH,

John H.

May 10 '06 #5
Reg
Thanks for your help JohnH.

In fact I make already Post after having defines the columns…
When I apply the ViewState method to the datagrid, I have an error: the
object cannot be serializable.
I will correct that but when I will recover my datagrid customer,
how to make for concerver the column with checkbox (with their values) ?

Reg

"JohnH" wrote:
Ah, I see. In order for the the "magic" ViewState reconstructor to
work, the BoundColumn definitions must have been added to the DataGrid
before the ViewState is processed, and the ViewState processor has to
be able to find them (the BoundColumns) by ID. So:

1. Add the BoundColumns to the DataGrid in the Page.OnInit method; and
2. Make sure you set the ID of each control in the columns.

HTH,

John H.

May 11 '06 #6

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

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
2
by: Kevin | last post by:
Hi Al Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific columns, how do I do this TI Kevin
0
by: Po | last post by:
I am using Windows authentication on the IIS server, ASP.NET impersonation turned off. In the code I use the impersonate function to impersonate the web user to access SQL server. I can get all...
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
1
by: Demetri | last post by:
I have a datagrid on an aspx page with one column added via property builder - the edit/update/cancel. In addition there is a dropdownlist which has a list of table names. Upon selecting one of...
3
by: Allen K | last post by:
Hi, I'm programmatically creating a HyperLink column for my datagrd ( in addition to Bound Columns created through the VS.NET Visual Interface ). However, when a Postback occurs, this column...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
10
by: Jeff | last post by:
Is there a workaround for datagrid contents being lost on postback? All other controls persist. It's just datagrids that appear to be reinitialized. It doesn't make sense to continually rebuild...
14
by: Ron L | last post by:
All I am working with a DataGrid and a form consisting of a number of text, checkbox, combobox controls, all bound to the same datatable. When I click on my "New" button, I create a new row,...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.