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

Discussion in 'ASP .Net Datagrid Control' started by Eagle, Jun 3, 2005.

  1. Eagle

    Eagle Guest

    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.
    Eagle, Jun 3, 2005
    #1
    1. Advertising

  2. Eagle

    Brock Allen Guest

    > 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

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen
    Brock Allen, Jun 6, 2005
    #2
    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. SirPoonga
    Replies:
    2
    Views:
    738
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    997
    weiwei
    Jan 5, 2007
  3. msimmons
    Replies:
    0
    Views:
    453
    msimmons
    Jul 16, 2009
  4. Jack Bates
    Replies:
    0
    Views:
    265
    Jack Bates
    May 2, 2011
  5. Replies:
    5
    Views:
    248
Loading...

Share This Page