Results 1 to 11 of 11

Thread: Show message on my webpage

  1. #1
    Junior Member
    Join Date
    Apr 2008
    Answers
    1

    Show message on my webpage

    how i can show msg on my webpage if there is no record show in a gridview
    i take many hyperlink button on my webpage and according to that data is shown in a gridview and the record is not matching gridview not appear at that time i want a msg in the webpage. please help me as soon as possible!!!


  2. #2
    Contributing Member
    Join Date
    May 2007
    Answers
    60

    Re: Show message on my webpage

    You can check the DataSource of the GridView if it is empty then show the message to the user.


  3. #3
    Junior Member
    Join Date
    May 2008
    Answers
    8

    Re: Show message on my webpage

    If there is no data to disply, the following code will show the message "No records found" in webpage.








    CellPadding="1" ForeColor="#333333"
    GridLines="None" Width="100%" FooterStyle-HorizontalAlign="Left"
    PagerStyle-HorizontalAlign="Left" PageSize="13" AllowPaging="True" OnRowDataBound="gvApplicants_RowDataBound" OnDataBound="gvApplicants_DataBound" OnRowEditing="gvApplicants_RowEditing" OnRowCancelingEdit="gvApplicants_RowCancelingEdit" >








    No records found



























  4. #4
    Contributing Member
    Join Date
    Jun 2007
    Answers
    65

    Re: Show message on my webpage

    Hi Nidhi,

    As per your quote it seems that u are populating grid with AutoGenerate columns property true.

    In this case u need to add EmptyDataTemplate to grid through code and put your message within it.

    In other case, u can right click on grid, go to Edit Template and click on EmptyDataTemplate. Type your message within area provided.

    Hope this would help u.


    ---V V---
    Vikas Vaidya


  5. #5
    Expert Member
    Join Date
    Dec 2007
    Answers
    138

    Re: Show message on my webpage

    There is simple solution for that in code check for Gridview contains, If the fridview contains no rows the do the response.write("your custom message");
    To check gridview contain no rows -> gridview object.rows.count==0 then response.write("");


  6. #6
    Junior Member
    Join Date
    May 2008
    Answers
    1

    Re: Show message on my webpage

    if(GridView1.Rows.Count==0)
    {
    //display your msg here.
    }

    thats it!


  7. #7
    Junior Member
    Join Date
    Jul 2008
    Answers
    2

    Re: Show message on my webpage

    SO SIMPLE DEAR,
    if there is record then its okay.
    but if there is not records comming to gridview then just make sure that gridview doesn't have any record by a small coding//
    That is,
    GridView1.DataBind();
    if (GridView1.Rows.Count ==0)
    {

    Label1.Text = "no such employee exits";
    }

    else { }
    it will first see that there is no data found so it will display that message...
    okay...
    for detail pls meet me at engg_nyks@yahoo.co.in
    bye


  8. #8
    Junior Member
    Join Date
    Dec 2008
    Answers
    2

    Re: Show message on my webpage

    you can give messge in emptydatatemplate as follow

    clik on the arrow on the top of the gridview control,click on edit template option and now select the emptyDataTemplate and write the message there


  9. #9
    Junior Member
    Join Date
    Oct 2008
    Answers
    3

    Re: Show message on my webpage

    Hi,

    Hope you are databinding gridview with some data source.

    Go to gridview properties and set EmptyDataText="Record not found".

    Hope this will help you.

    Thanks,


  10. #10
    Junior Member
    Join Date
    Mar 2009
    Answers
    6

    Re: Show message on my webpage

    Hi,
    Below is the code for showing the message where the grid retrieves no data :
    Here i have taken one lable to show the message.

    Dim con as new sqlconnection(str) ''here str is the connection string
    dim sql as string
    dim count as integer
    con.open()
    sql ="select id,name,mailid from emp"
    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()


    Happy coding,
    Ramesh....


  11. #11
    Junior Member
    Join Date
    Mar 2009
    Answers
    2

    Re: Show message on my webpage

    Quote Originally Posted by nidhi.amulya View Post
    how i can show msg on my webpage if there is no record show in a gridview
    i take many hyperlink button on my webpage and according to that data is shown in a gridview and the record is not matching gridview not appear at that time i want a msg in the webpage. please help me as soon as possible!!!

    ans:
    go 2 gridview then select Edit temples you will get a box over there then write your message there .


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact