ASP.NET 2.0: GridView, autogeneratecolumns="true" is not working

Discussion in 'ASP .Net' started by Sachin, Mar 5, 2006.

  1. Sachin

    Sachin Guest

    Hi All,

    I am using ASP.NET 2.0 and GridView control.

    I have a stored procedure, SP_GetAllRows which takes the table name as
    parameter and fires the query "Select * from TableName" dynamically.

    My GridView defined like,


    <asp:gridview id="CustomersGridView"
    datasourceid="CustomersSource"
    autogeneratecolumns="true"
    emptydatatext="No data available."
    allowpaging="true"
    runat="server">


    In the code behinde file, I set the datasource and call databind.

    However, gridview does not display any records even when the stored
    procedure returns the rows.
    I have verified this through debugger. In fact, when no records are returned
    it does display the message, "No data avaialable".

    I changed the GridView to DataGrid, but it does not work also.

    If I use bound columns and explicitely specify the column name it does work.

    However, as store procedure returns the records from different tables at run
    time, I am using autogeneratecolumns="true".

    What could be wrong?

    Why autogeneratecolumns="true" is not working?

    Any pointer or help?

    TIA
    Sachin
     
    Sachin, Mar 5, 2006
    #1
    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. David M. Weprin
    Replies:
    0
    Views:
    434
    David M. Weprin
    Oct 16, 2003
  2. =?Utf-8?B?bmt3?=

    Format GridView with AutoGenerateColumns=true

    =?Utf-8?B?bmt3?=, Mar 8, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    1,886
    Pak Lui
    Mar 11, 2007
  3. Aamir Ghanchi

    GridView AutoGenerateColumns not working

    Aamir Ghanchi, Oct 10, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    519
    IfThenElse
    Oct 11, 2007
  4. bdb112
    Replies:
    45
    Views:
    1,399
    jazbees
    Apr 29, 2009
  5. nkw

    Format GridView with AutoGenerateColumns=true

    nkw, Mar 8, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    964
    Pak Lui
    Mar 11, 2007
Loading...

Share This Page