gridview doesn't show data at first page load

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
 
T

tarscher

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
 
E

Eliyahu Goldin

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

Eliyahu Goldin

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top