Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display empty datagrid

Status
Not open for further replies.

ludmann

Programmer
Apr 14, 2004
49
0
0
GB
I am displaying a datagrid, whereby rows added by the user are displayed. The problem is I am starting from an empty datagrid, and to start off with only want to display the header and the footer.

It seems like asp.net does not display the datagrid, if it has no items.

Any way around this?

Marika
 
I usually just display a messages like "No items to display
 
I want to bind the datagrid to an ArrayList, which is to be filled by the user.

Only when all complete, that I submit to the database. So in this case how would I display "empty list"?

 
could you bind each column with a blank value? ""

then when the user clicks on the update button, all the text boxes are blank and ready to update.

dlc
 
I don't know in advance how many records are going to be added. I guess I could set the first item of the array list to "" and when I insert the array list items into the database just skip the first item.
 
You can add a button outside of the dg that adds a row...
 
Or instead...when the "Add Row" is done, you can check to see if there is only one row in the DG. If there is, then "update" it with the new values. If there is more than one row, then "add" your row.

This way, when you start the DG will show up because there is a blank row. When you add one row, the first row will no longer be blank and will contain values. All subsequent rows will also contain data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top