I have a webgrid which displays the headers and group by box even if there is no data to display. How do I display a message 'Your search criteria have given no results.Please re-try with a different search criteria' when there is no data to display?
I believe the NoDataMessage property directly on the DisplayLayout settings may be helpful in your case, for example:
<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server"> <DisplayLayout NoDataMessage="No Data Displayed"><igtbl:UltraWebGrid>
In the case where you want to hide the grid altogether (columns and everything), you can set the Visible property of the grid to false and display a label with custom message if the datasource has 0 rows.
Hope this helps.
I have tried using the NoDataMessage without any effect.I am using Sqldatasource .
Is there something similar to '<EmptyDataTemplate' (available in gridview)
in ultrawebgrid
GokulKannanK said:I have tried using the NoDataMessage without any effect.
IIRC, I've seen it work. Then again, I'm unable to find an example in my own applications; for some reason I ended up not relying on it.
Sorry. I'm just a developer like you. Maybe the IG staff will give us a clue.
I've found an example that works. Here's my markup:
<igtbl:UltraWebGrid ID="dgSuppFiles" runat="server" Width="736px" Height="83px">
<DisplayLayout AllowDeleteDefault="Yes" AllowAddNewDefault="Yes" RowHeightDefault="20px" Version="3.00" SelectTypeRowDefault="Single" BorderCollapseDefault="Separate" Name="dgSuppFiles" AllowUpdateDefault="Yes" NoDataMessage="No documents have been uploaded.">
<AddNewBox> <BoxStyle borderwidth="1px" borderstyle="Solid" backcolor="LightGray" /> </AddNewBox>
<Pager> <PagerStyle BorderWidth="1px" BorderStyle="solid" BackColor="LightGray" /> </Pager>
<HeaderStyleDefault Font-Names="Verdana" Font-Bold="True" BorderStyle="Solid" HorizontalAlign="Left" BackColor="#EBF0F9"> <BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White"></BorderDetails> </HeaderStyleDefault>
<FrameStyle Width="736px" BorderWidth="1px" Font-Size="8pt" Font-Names="Verdana" BorderColor="#517DBF" BorderStyle="Solid" BackColor="Transparent" Height="83px"> </FrameStyle>
<FooterStyleDefault BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray"> <BorderDetails ColorTop="White" WidthLeft="1px" WidthTop="1px" ColorLeft="White"></BorderDetails> </FooterStyleDefault>
<ClientSideEvents AfterRowDeletedHandler="UltraWebGrid1_AfterRowDeletedHandler" />
<ActivationObject BorderColor="1, 68, 208"></ActivationObject>
<EditCellStyleDefault BorderWidth="0px" BorderStyle="None"></EditCellStyleDefault>
<SelectedRowStyleDefault BackColor="#9FBEEB"></SelectedRowStyleDefault>
<RowAlternateStyleDefault BackColor="White"></RowAlternateStyleDefault>
<RowStyleDefault BorderWidth="1px" BorderColor="#517DBF" BorderStyle="Solid"> <Padding Left="3px"></Padding> <BorderDetails WidthLeft="0px" WidthTop="0px"></BorderDetails> </RowStyleDefault>
</DisplayLayout>
<Bands>
<igtbl:UltraGridBand HeaderClickAction="SortMulti" AllowUpdate="No" AllowAdd="No" CellClickAction="Edit"> <HeaderStyle BackColor="#EAF2F7"></HeaderStyle> </igtbl:UltraGridBand>
</Bands>
</igtbl:UltraWebGrid>