Re: AutoGenerateColumns won't set to false

From: Chance Hopkins (chance_hopkins_at_hotmail.com)
Date: 11/06/04


Date: Sat, 6 Nov 2004 12:22:46 -0500

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 [MVP]" <vapor at steaming post office> wrote in message
news:OuA1eLCxEHA.1192@tk2msftngp13.phx.gbl...
> 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/27***
> "Chance Hopkins" <chance_hopkins@hotmail.com> wrote in message
> news:uyT28LBxEHA.3844@TK2MSFTNGP09.phx.gbl...
>>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?
>>
>>
>>
>
>