gridview doesn't show data at first page load

  • Thread starter Thread starter tarscher
  • Start date Start date
T

tarscher

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
 
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]


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
 
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.
 
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]


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]


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
 
Back
Top