Get value of drop down list from one user control to another -- raise event?

E

Eagle

I have tried just about everything that I can understand.

I have 2 user controls on a form. One user control has a drop down list,
and the 2nd user control has a datagrid, that is editable.

When the drop down list is changed, I need the 2nd user control to be
refreshed with new information. That's fine, I can rebind the grid in the
page_load. However, rebinding the grid in the Page_Load, prevents the edit
from working, as the edit causes a postback, which rebinds the grid and
returns it to normal. If I rebind the grid only on not postback, then the
drop down list doesn't cause the 2nd control to reflect the new information.

I don't understand the raise event feature -- when I watch the stack, the
2nd control always loads first, so how can it grab data from the 1st control
when it hasn't even loaded yet. Seems very backward to me, if the drop down
list is on the 1st control, and the user clicks the drop down list to change
its value, why would the 2nd control load first, rendering the
dropdownlist's select index changed event useless. And the form itself
loads last! So even if I raise the event and grab it with the form, since
the 2nd control is already loaded, then it still doesn't force the 2nd
control to reload with the new value.

What am I missing? Can you be very explicit in your explanation with some
samples, as I have read many many samples that I do not understand.

Thank you very much.
 
B

Brock Allen

What am I missing? Can you be very explicit in your explanation with
some samples, as I have read many many samples that I do not
understand.

Logically what you want is for the first control to raise an onchange event,
the page would then handle that event and call into the second control to
rebuild/databind itself. So, you'd need to create a custom event from your
first control. Here's a quick example:

http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx#exposingevts
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top