AutoGenerateColumns won't set to false

Discussion in 'ASP .Net Datagrid Control' started by Chance Hopkins, Nov 6, 2004.

  1. 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?
     
    Chance Hopkins, Nov 6, 2004
    #1
    1. Advertising

  2. 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:...
    > 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" <> wrote in message
    > news:...
    >>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?
    >>
    >>
    >>

    >
    >
     
    Chance Hopkins, Nov 6, 2004
    #2
    1. Advertising

  3. 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 [MVP]" <vapor at steaming post office> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    >>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?
    >>
    >>
    >>

    >
    >
     
    Chance Hopkins, Nov 6, 2004
    #3
  4. 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" <> wrote in message
    news:...
    >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?
    >
    >
    >
     
    Alvin Bruney [MVP], Nov 6, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. André
    Replies:
    3
    Views:
    1,678
  2. Tim Mackey
    Replies:
    5
    Views:
    806
    Tim Mackey
    Oct 1, 2007
  3. Emil O
    Replies:
    0
    Views:
    236
    Emil O
    Sep 2, 2003
  4. pietaster
    Replies:
    1
    Views:
    161
    Bernard O'Flynn
    Oct 28, 2003
  5. pietaster

    AllowPaging and AutoGenerateColumns = false

    pietaster, Oct 31, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    172
    Giorgio Parmeggiani
    Oct 31, 2003
Loading...

Share This Page