Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
Force column generation in binding UltraWebGrid to empty table
posted

Hi!

Is it possible to force the grid to generate columns even though the table has 0 rows?  I dropped a grid on an aspx page in the designer and after binding a dataset which has a table with 0 rows, the columsn do get generated (so the user can see that the report did run but dodn't generate any data).  Note: I have AutoGenerateColummns = true (in the designer).

 Then, as a test, on another page, I create a grid programmatically, using:

UltraWebGrid grid = new UltraWebGrid("UltraWebGrid1");

and set AutoGenerateCOlumns to true.

However, after:

grid.DataSource = ds.Tables[0];

grid.DataBind();

I get "Object not set (NullReference)" exception.

So, the question is: how is it that when created in the designer the grid does generate columns gracefully, but when created dynamically, the grid throws an exception on DataBind() ?

Thanks in advance!

Regards,

S