C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




gridview


Posted Date: 02 Aug 2007      Total Responses: 2

Posted By: vijay       Member Level: Silver     Points: 2


HI

I want to display records in gridview .if records are their then they should appear on gridview and if no records are their then a message should be displayed on label.

Thank u




Responses

Author: Vijay Kumar Naidu    02 Aug 2007Member Level: GoldRating:     Points: 2
Dear Vijay,

You can very well do this! All you have to do is to set one of the property in GridView called "EmptyDataText = << Your message if no records available >>".

I believe this answer will help you. Enjoy!!

-Vijay Kumar Naidu.


Author: Balaraju Veeragoni    02 Aug 2007Member Level: SilverRating:     Points: 2
Hi,just look at this
<table Width="100%">
<tr>
<td colspan="2">
<asp:Label id="lblError" ForeColor="red" EnableViewState="false" Runat="Server" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:GridView id="grdListEmp" runat=server/>
</td>
</tr>
</table>
the abvoe code is for placing oneerror Label and GridView

in the page:
Page_Load()
{
If(!Page.IsPostBack)
{
if(ds.table[0].rows.count>0)
{
GridView.DataSource=ds.table[0];
GridView.DataBind();
}
else
{
lblError.text="No Records are found";
}
}
}



Post Reply
You must Sign In to post a response.
Next : How to end the Session when user closes the browser window
Previous : Validation Expression for Regular Expression Validator Plz Urgent
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

web conferencing

Contact Us    Privacy Policy    Terms Of Use