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

S

Sachin

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
 

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,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top