AutoGenerateColumns won't set to false

C

Chance Hopkins

I have a really strange problem

I have a project that has been working fine for years.

I have a datagrid with one column. AutoGenerate Columns is set to false and
it was working fine for years.

All of the sudden, it shows all the columns. The grid will NOT stick to just
one.

I am absolutely baffled.

AutoEventWireup="false" is set in the aspx page also. I can't find any
reason for this.

Any ideas?
 
C

Chance Hopkins

Thanks for the reply.

Same behavior on two machines, Laptop and server. (Problem is obviously in
the code somewhere)

I haven't installed any patches on either machine this week.

I went so far as to open up a back up of the class, from two months ago and
copy/paste it into my project.

It does the same thing. I'm at a loss what to check. The code is really
straight forward:

DataGrid grid = new DataGrid();

grid.ID="grid";
grid.AutoGenerateColumns=false;

//omited style and paging properties

System.Web.UI.WebControls.ButtonColumn colm = new ButtonColumn();

colm.CommandName = "select";

grid.Columns.Add(colm);

this.Controls.Add(grid);


-------------------------

Bound up like this in another method:

//ds is a dataset, works fine

DataTable dt = ds.Tables[0];
grid.CurrentPageIndex = 0;
grid.SelectedIndex = 0;
grid.DataSource = dt;
grid.DataKeyField = "myfield";

grid.Columns[0].HeaderText = "mytitle";

((ButtonColumn)grid.Columns[0]).DataTextField = "myfield";

grid.DataBind();



Alvin Bruney said:
I'm sorry, things don't just break all of a sudden. Check your patches and
security installation logs for that server. Also check your source code
changes that were pushed out or assembly changes.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Chance Hopkins said:
I have a really strange problem

I have a project that has been working fine for years.

I have a datagrid with one column. AutoGenerate Columns is set to false
and it was working fine for years.

All of the sudden, it shows all the columns. The grid will NOT stick to
just one.

I am absolutely baffled.

AutoEventWireup="false" is set in the aspx page also. I can't find any
reason for this.

Any ideas?
 
C

Chance Hopkins

I FIXED IT!!!!

Here is what happend. I referenced another assembly where there was an
object in the same namespace called DataGrid, which I had made to handle
automated sorting. It was called DataGrid so I was actually creating it
instead of the System.Web.UI.DataGrid. The one I was creating had
AutoGenerateColumns set to true in the onload statement, so when it fired my
setting was canceled out (I suppose I should move it to oninit also).

Sorry bout that :)


Thanks for the help.




Alvin Bruney said:
I'm sorry, things don't just break all of a sudden. Check your patches and
security installation logs for that server. Also check your source code
changes that were pushed out or assembly changes.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Chance Hopkins said:
I have a really strange problem

I have a project that has been working fine for years.

I have a datagrid with one column. AutoGenerate Columns is set to false
and it was working fine for years.

All of the sudden, it shows all the columns. The grid will NOT stick to
just one.

I am absolutely baffled.

AutoEventWireup="false" is set in the aspx page also. I can't find any
reason for this.

Any ideas?
 
A

Alvin Bruney [MVP]

I'm sorry, things don't just break all of a sudden. Check your patches and
security installation logs for that server. Also check your source code
changes that were pushed out or assembly changes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top