This is a migrated thread and some comments may be shown as answers.

Grid with no details not showing

1 Answer 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brendan Vogt
Top achievements
Rank 1
Brendan Vogt asked on 30 Aug 2008, 09:03 AM

Hi,

I populate my grid data with the given client ID, as follows:

private void LoadCharges()
{
   int _ClientId = 0;
   List<ClientCharges> clientCharges = ClientChargesManager.QueryClientChargesByClientId(_ClientId);
   
   rgCharges.DataSource = clientCharges;
   rgCharges.DataBind();
}


I am looking for a blank grid that says something like "No charges found", so I tried sending it a client ID of 0 (this client ID does not exist), but then the grid is not even populated.  It doesn't even appear.

Here is my grid:

<radG:RadGrid
   ID="rgCharges"
   AutoGenerateColumns="false"
   GridLines="None"
   runat="server">
   <MasterTableView NoMasterRecordsText="Nothing.." NoDetailRecordsText="None" DataKeyNames="ClientChargeID">
   <Columns>
      <radG:GridBoundColumn DataField="ChargeAmount" HeaderText="Charge Amount" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="right" UniqueName="ChargeAmount" DataFormatString="{0:###,###.00}">
      </radG:GridBoundColumn>
   </Columns>
   </MasterTableView>
</radG:RadGrid>


Please help.

Thanks
Brendan

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 01 Sep 2008, 06:05 AM
Hi Brendan,

I don't know which version of the Grid you are using. In my Grid(5.1.1) I set the ShowHeadersWhenNoRecords property to true and it is working properly.

ASPX:
<MasterTableView  NoMasterRecordsText="No records in the master table" ShowHeadersWhenNoRecords="true"   > 
                  


One another suggestion will be to set the DataSource of the Grid as shown below to display the empty Grid.

CS:
RadGrid.DataSource=new String[]{}; 


Thanks
Shinu.
Tags
Grid
Asked by
Brendan Vogt
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or