All,
I have a datagrid that I use in a ASP.net web page that loads customer data
based on the selected customer ID
Some Customers will have no data in the database (which is oracle 9.2) . So
I check the .HasRows property first then if it is false I skip the data bind
like so
If OraReader.HasRows Then
grdCustomerDetails.AutoGenerateColumns = False
grdCustomerDetails.DataSource = OraReader
grdCustomerDetails.DataBind()
Else
grdCustomerDetails.DataBind()
End If
OraReader = nothing
The reason I do the check rows is to avoid the row headers from being
populated in the grid when there is no data.
If I do not do the .DataBind() in the else portion of the If statement then
the previous data is still present and a user may be confused as the may
think the data belongs to the current customer (who in fact has no data.)
The other question I have involves the currently selected record.
When a user selects a record within the Grid then some processing is done on
the record and the page is posted back. when the page is posted back can I
"deselect" the record. i.e. have nothing selected in the grid after a post
back
All suggestions and ideas are appreciated.
Thanks
Jawahar
|