gridview doesn't show data at first page load

Discussion in 'ASP .Net' started by tarscher@gmail.com, Aug 29, 2006.

  1. Guest

    Hi all,

    I have a gridview populated with data coming from a dataset (created
    via the wizard). The data shown in the gridview is dependent on the the
    choice of a control (dropdown with autopostback enabled). When I load
    the page for the first time I the gridview is empty. When I select
    something in the dropdownlist the gridview is populated correctly. I
    guess this has something to do with the fact that the first time no
    data from the dropdownlist is send to the gridview.

    Someone has an idea on how to solve this?

    Regards,
    Stijn
    , Aug 29, 2006
    #1
    1. Advertising

  2. Guest

    Thanks for the fast reply. since I'm a beginning .NET programmer I have
    a hard time understanding the answer. Can you please explain me where I
    can find the DLL event handler?

    Also, when adding this to Page_Load, won't this then happen every time
    the page loads. Thus over writing the user selection via the the drop
    down lists?

    Regards,
    Stijn


    Eliyahu Goldin schreef:

    > Stijn,
    >
    > Somewhere in the ddl event handler you may have a piece a code that
    > populates the grid. Try to locate it and copy it over to the Page_Load
    > event.
    >
    > --
    > Eliyahu Goldin,
    > Software Developer & Consultant
    > Microsoft MVP [ASP.NET]
    >
    >
    > <> wrote in message
    > news:...
    > > Hi all,
    > >
    > > I have a gridview populated with data coming from a dataset (created
    > > via the wizard). The data shown in the gridview is dependent on the the
    > > choice of a control (dropdown with autopostback enabled). When I load
    > > the page for the first time I the gridview is empty. When I select
    > > something in the dropdownlist the gridview is populated correctly. I
    > > guess this has something to do with the fact that the first time no
    > > data from the dropdownlist is send to the gridview.
    > >
    > > Someone has an idea on how to solve this?
    > >
    > > Regards,
    > > Stijn
    > >
    , Aug 29, 2006
    #2
    1. Advertising

  3. Stijn,

    Somewhere in the ddl event handler you may have a piece a code that
    populates the grid. Try to locate it and copy it over to the Page_Load
    event.

    --
    Eliyahu Goldin,
    Software Developer & Consultant
    Microsoft MVP [ASP.NET]


    <> wrote in message
    news:...
    > Hi all,
    >
    > I have a gridview populated with data coming from a dataset (created
    > via the wizard). The data shown in the gridview is dependent on the the
    > choice of a control (dropdown with autopostback enabled). When I load
    > the page for the first time I the gridview is empty. When I select
    > something in the dropdownlist the gridview is populated correctly. I
    > guess this has something to do with the fact that the first time no
    > data from the dropdownlist is send to the gridview.
    >
    > Someone has an idea on how to solve this?
    >
    > Regards,
    > Stijn
    >
    Eliyahu Goldin, Aug 29, 2006
    #3
  4. You have a dropdown list (ddl, not dll) with autopostback enabled. This
    means when you change the ddl selection, a postback fires. Did you setup
    SelectedIndexChanged event for the ddl? If you didn't, a postback will still
    fire and the page will get loaded on the server. The code in Page_Load event
    will run. You can use IsPostBack property to tell between the first page
    load and the postbacks. This is the answer on your second question.

    --
    Eliyahu Goldin,
    Software Developer & Consultant
    Microsoft MVP [ASP.NET]


    <> wrote in message
    news:...
    > Thanks for the fast reply. since I'm a beginning .NET programmer I have
    > a hard time understanding the answer. Can you please explain me where I
    > can find the DLL event handler?
    >
    > Also, when adding this to Page_Load, won't this then happen every time
    > the page loads. Thus over writing the user selection via the the drop
    > down lists?
    >
    > Regards,
    > Stijn
    >
    >
    > Eliyahu Goldin schreef:
    >
    >> Stijn,
    >>
    >> Somewhere in the ddl event handler you may have a piece a code that
    >> populates the grid. Try to locate it and copy it over to the Page_Load
    >> event.
    >>
    >> --
    >> Eliyahu Goldin,
    >> Software Developer & Consultant
    >> Microsoft MVP [ASP.NET]
    >>
    >>
    >> <> wrote in message
    >> news:...
    >> > Hi all,
    >> >
    >> > I have a gridview populated with data coming from a dataset (created
    >> > via the wizard). The data shown in the gridview is dependent on the the
    >> > choice of a control (dropdown with autopostback enabled). When I load
    >> > the page for the first time I the gridview is empty. When I select
    >> > something in the dropdownlist the gridview is populated correctly. I
    >> > guess this has something to do with the fact that the first time no
    >> > data from the dropdownlist is send to the gridview.
    >> >
    >> > Someone has an idea on how to solve this?
    >> >
    >> > Regards,
    >> > Stijn
    >> >

    >
    Eliyahu Goldin, Aug 29, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. venky

    Page Load and webcontrol page load

    venky, Jul 6, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    3,100
    venky
    Jul 11, 2005
  2. fh
    Replies:
    9
    Views:
    1,030
  3. Replies:
    0
    Views:
    702
  4. Rasika WIJAYARATNE
    Replies:
    0
    Views:
    611
    Rasika WIJAYARATNE
    Dec 14, 2007
  5. Albert Hopkins
    Replies:
    0
    Views:
    527
    Albert Hopkins
    Feb 23, 2009
Loading...

Share This Page