views:

1847

answers:

5

In VB.NET i am fatching data from table using Dataset(SQL server 2008). When there is data in table it displays data properly in the GRID but when there is no data in the Table it shows the grid's basic view.

How can i display the column name of the tables as Headings of the ULTRAGRID even when there is no data in Table???

A: 

This is discussed in this Infragistics forum thread.

Galwegian
A: 

thanx for the reply but i think the problem that JD having is bit diff then mine...here in my application the data get fatched properly from SQL when there is data in the table and it gets displayed properly also but when i am not having any data in the table at that time i wants to display the columns of the table as the heading of the grid with 0 rows that is not happening.

it just shows messagebox no data found and then the default display of grid is getting displayed in the application.

Thanx Savan

Savan Parmar
A: 

not helpfull...looking for help

Savan Parmar
A: 

Do you know what the headers of the columns will be or is it dynamic based on the data in the table? If you know beforehand you can create the columns with the appropriate headers in an empty dataset and assign that to the grids datasource.

DaveK
A: 

I notice this same behavior when I manually create a datatable and assign it as the grid's datasource. If the data table is empty, all the column header info that was previously set on the grid is lost. My solution to this was to never actually give it an empty table, if I have no rows in my table, at least have all the columns defined.

DataTable table = new DataTable("fooTable");
table.Columns.Add("fooCol1", typeof(long));
table.Columns.Add("fooCol2", typeof(string));
table.Columns.Add("fooCol3", typeof(bool));
myUltraGrid.DataSource = table;

By never setting the grid to an empty table, you keep your header info.

auujay