none
problem with gridview .gridview not loading on button click(ASP.NET)

    Question

  • i am using a function and passing all the variable  values through txtboxes

    code for btn click to display the grid view.

      Gridview1.DataSource =

    HelpDeskBL.HelpDesk_GetEventNotifications(CInt(txtDealershipID.Text), txtEmployeeID.Text, TxtStartDate.Text, TxtEndDate.Text, DBName) \\i could c the griview having 2000 row while geting data.

               Gridview1.DataBind() \\

     when i use    GVEvents.DataBind().i dnt see the rows there.

    both gridview and button are in panel

    can someone plase tel me why i cant see the gridview

    Thanks



    akhila




    i was able to load the data if i give  ispostback but not all the times .
    • Edited by sql learner12 Friday, June 08, 2012 7:03 PM
    • Moved by Bob_BaoMVP Monday, June 11, 2012 9:30 AM (From:Visual Basic General)
    Friday, June 08, 2012 6:25 PM

Answers

  • you should set AutoGenerateColumns Property of Gridview or create columns manually and set the data field property of them ... 
     Gridview1.AutoGenerateColumns = true


    Saturday, June 09, 2012 4:59 AM
  • what you can do is, first get the data in a datatable and bind that datatable to GridView.

    Also, you can check if there are rows in datatable or not. And, if there are no rows in it, gridview won't appear.



    Amit Govil | Email

    "Weeks of coding can save you hours of planning"

    • Marked as answer by sql learner12 Monday, June 11, 2012 2:34 PM
    Saturday, June 09, 2012 1:20 PM

All replies

  • you should set AutoGenerateColumns Property of Gridview or create columns manually and set the data field property of them ... 
     Gridview1.AutoGenerateColumns = true


    Saturday, June 09, 2012 4:59 AM
  • what you can do is, first get the data in a datatable and bind that datatable to GridView.

    Also, you can check if there are rows in datatable or not. And, if there are no rows in it, gridview won't appear.



    Amit Govil | Email

    "Weeks of coding can save you hours of planning"

    • Marked as answer by sql learner12 Monday, June 11, 2012 2:34 PM
    Saturday, June 09, 2012 1:20 PM
  • Hi Akhila,

    Thanks for your post.

    This queue is for VB.Net. The GridView is a Web UI control witch is out of scope here. I will move this thread to off-topic forum. Microsoft Corporation provides a special website to deal with the ASP.Net issue. You can post your thread to this link: http://forums.asp.net/

    Sorry for any incontinences and have a nice day.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us

    Monday, June 11, 2012 9:15 AM
  • Thank you Mark

    akhila

    Monday, June 11, 2012 2:34 PM
  • Thanks amit!

    akhila

    Monday, June 11, 2012 2:34 PM
  • Thanks pooyan Fekraty.. this is what i had to correct..

    akhila

    Monday, June 11, 2012 2:35 PM