Results 1 to 6 of 6

Thread: How to show message on my webpage in the ASP.NET

  1. #1
    Join Date
    Dec 2009
    Posts
    30

    How to show message on my webpage in the ASP.NET

    Hi everybody,

    I am a IT student and developing a project in ASP.NET. In my project i want to show a message without using gridview. I am using hyperlink button for that but it have using gridview and data is shown there. When i execute my program, the record is not matching the the gridview. Can anybody help for this , i am in so hurry as i want to finish my project in one week. Other suggestion is also welcome.

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Show message on my webpage in the ASP.NET 2003

    Can you tell me what version you have used in ASP.NET, So i will try on own myself.Also i will check thsi code on ASP.NET 2003 version and found not any error on my home page.

    if(GridView1.Rows.Count==0)
    {
    //display your message here
    Hello world
    }

  3. #3
    Join Date
    Dec 2009
    Posts
    30

    Re: Using ASP.NET 2005 version as frontend

    Actually i am using ASP.NET 2005 as front end and SQL server 2005 as back end. I will run the page through IIS 6.0 version. Thanks for reply.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Code for show message on webpage in the ASP.NET

    I will try on ASP.NET 2005 and i will succeed. Please try this code and reply if found any error.

    <table style="width: 60%; height:50%" border="0">
    <tr style="width: 60%; height:200px" valign="top">
    <td>
    <asp:GridView ID="gvApplicants" runat="server" AutoGenerateColumns="False"
    CellPadding="1" ForeColor="#653333"
    GridLines="None" Width="80%" FooterStyle-HorizontalAlign="Left"
    PagerStyle-HorizontalAlign="Left" PageSize="10" AllowPaging="True" OnRowDataBound="gvApplicants_RowDataBound" OnDataBound="gvApplicants_DataBound" OnRowEditing="gvApplicants_RowEditing" OnRowCancelingEdit="gvApplicants_RowCancelingEdit" >

    <FooterStyle BackColor="#509CD7" Font-Bold="True" ForeColor="yellow" HorizontalAlign="Left" CssClass="GridView" />
    <RowStyle BackColor="#EFS3FB" CssClass="GridView" />
    <SelectedRowStyle Font-Bold="True" ForeColor="#335633" Font-Size="Small" BackColor="#8080FF" BorderColor="#8070FF" />
    <PagerStyle BackColor="#2469BF" ForeColor="White" HorizontalAlign="Center" Font-Size="Small" />
    <HeaderStyle BackColor="#507CD7" Font-Bold="True" ForeColor="Blue" CssClass="GridView" />
    <AlternatingRowStyle BackColor="Pink" />
    <EmptyDataTemplate>
    No records found in your database
    </EmptyDataTemplate>
    <PagerTemplate>
    </PagerTemplate>
    <Columns>
    <asp:BoundField Visible="false" DataField="pers_no" />
    <asp:TemplateField HeaderText="Applicant Number" HeaderStyle-HorizontalAlign="Right">
    <ItemTemplate>
    <asp:Label ID="lblAppNo" runat="server" Width="36%" CssClass="Label" Text='<%#Eval("empno")%>'></asp:Label>
    </ItemTemplate>
    <ItemStyle HorizontalAlign="Right" />
    <ItemStyle width= "7%" />
    </asp:TemplateField>
    <asp:BoundField>
    <ItemStyle Width="4%" />
    <HeaderStyle Width="4%" />
    </asp:BoundField>
    <asp:TemplateField HeaderText="Name" HeaderStyle-VerticalAlign="top">
    <ItemTemplate>
    <asp:Label ID="lblName" runat="server" Width="100%" CssClass="Label" Text='<%#Server.HtmlEncode((string)Eval("name"))%>'></asp:Label>
    </ItemTemplate>
    <ItemStyle />
    </asp:TemplateField>
    </Columns>
    </asp:GridView>
    </td>
    </tr>
    <tr style="border:2px">
    </tr>
    </table>

  5. #5
    Join Date
    May 2008
    Posts
    2,389

    Use EmptyDataTemplate to show message on webpage

    In your case, You should right click on grid then go to Edit Template and click on EmptyDataTemplate. Type your message as you want to display on tour website within area provided and check that. I will also try in my project and show my message on my web page.

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    SQL server check show message on webpage in the ASP.NET

    I think you should check with SQL server 2005. As the below code, It will show message.

    Dim con as new sqlconnection(str)
    dim sql as string
    dim count as integer
    con.open()
    sql ="select id,name,phoneno from shop"
    dim da as new sqldataadapter(sql ,con)
    dim ds as new dataset
    da.fill(ds,"emp")
    gridview1.datasource=ds.tables(0)

    if ds.tables(0).rows.count<1 then
    lable1.text="No Records found"
    else
    lable1.visible=false
    end if
    gridview1.databind()
    con.close()

Similar Threads

  1. ASUS P7H55-M PRO does not show POST message
    By Federline in forum Motherboard Processor & RAM
    Replies: 4
    Last Post: 08-04-2011, 10:15 AM
  2. Internet Explorer cannot display the webpage (error message)
    By Rachel G in forum Windows Security
    Replies: 3
    Last Post: 05-01-2010, 01:24 AM
  3. Log in screen show unread message in Outlook 2007
    By Julli_gaada in forum Windows Software
    Replies: 3
    Last Post: 09-12-2009, 04:01 PM
  4. Iphone Show no sim card message
    By Reuben in forum Portable Devices
    Replies: 3
    Last Post: 13-07-2009, 12:54 PM
  5. IE7 error message: Navigation to the webpage was canceled
    By John Halsey Flannery in forum Vista Help
    Replies: 2
    Last Post: 19-03-2009, 12:13 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,136,799.75801 seconds with 17 queries