Re: Syncronizing two instances of the same control

Discussion in 'ASP .Net' started by Hermit Dave, Jan 9, 2004.

  1. Hermit Dave

    Hermit Dave Guest

    look you have

    Control (Panel) A having child control a and b (DDLs)
    Control (Panel) B having child contols a and b (DDLs)

    what you need to understand is that when the onchange event is fired its
    fired for either
    A.child a
    or
    B.child a
    you cant have just a child a event and expect it up update both.... they are
    different objects by themselves... the only reason you are not having a
    conflict is that they have two distinct containers... it Control A and
    Control B

    what you need to do is create public methods on child a which can get or set
    selected index
    that way the Control A . child a's on change is fired... you can call a set
    on Contol B. child a

    HTH

    --
    Regards,

    HD

    "Aaron Prohaska" <> wrote in message
    news:...
    > Hermit Dave wrote:
    >
    > > Just had a quick look at your code... sorry mind's bit lethargic at this
    > > hour (past midnight)
    > > okay
    > > you are adding those two to the code behind file.. and each instance

    handles
    > > its own events...
    > > like this.optionsHeader.ManufacturerChanged += new
    > > FramesViewOptionsEventHandler( this.ManufacturerChanged );
    > > now...
    > > what i actually couldnt see was onchange event... where are you getting

    hold
    > > of the other panal and passing it the value of selected index ?
    > >

    >
    > I don't completely understand you question, but the onchange event
    > (AutoPostBack = true) is set at line 93 of FramesViewOptions.cs. Most of
    > the functionality is done in the FramesViewOptions class, take a look
    > and see if it answers your question.
    >
    > Regards,
    >
    > Aaron Prohaska
    >
    > -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
    > Wrench Science Inc.
    > http://www.wrenchScience.com/
    > Phone: 510.841.4748 x206
    > Fax: 510.841.4708
    > -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
     
    Hermit Dave, Jan 9, 2004
    #1
    1. Advertising

  2. Hermit Dave wrote:

    > look you have
    >
    > Control (Panel) A having child control a and b (DDLs)
    > Control (Panel) B having child contols a and b (DDLs)
    >
    > what you need to understand is that when the onchange event is fired its
    > fired for either
    > A.child a
    > or
    > B.child a
    > you cant have just a child a event and expect it up update both.... they are
    > different objects by themselves... the only reason you are not having a
    > conflict is that they have two distinct containers... it Control A and
    > Control B
    >
    > what you need to do is create public methods on child a which can get or set
    > selected index
    > that way the Control A . child a's on change is fired... you can call a set
    > on Contol B. child a
    >
    > HTH
    >


    I still don't understand what your telling me, but I'm working on it.
    You say that I have the following situation;

    > Control (Panel) A having child control a and b (DDLs)
    > Control (Panel) B having child contols a and b (DDLs)


    and I thought I had something more like this;

    Control (Panel) A having child control a
    Control (Panel) B having child control b

    What does the (DDLs) mean?

    Regards,

    Aaron Prohaska

    -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
    Wrench Science Inc.
    http://www.wrenchScience.com/
    Phone: 510.841.4748 x206
    Fax: 510.841.4708
    -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
     
    Aaron Prohaska, Jan 9, 2004
    #2
    1. Advertising

  3. Hermit Dave wrote:

    > look you have
    >
    > Control (Panel) A having child control a and b (DDLs)
    > Control (Panel) B having child contols a and b (DDLs)
    >
    > what you need to understand is that when the onchange event is fired its
    > fired for either
    > A.child a
    > or
    > B.child a
    > you cant have just a child a event and expect it up update both.... they are
    > different objects by themselves... the only reason you are not having a
    > conflict is that they have two distinct containers... it Control A and
    > Control B
    >
    > what you need to do is create public methods on child a which can get or set
    > selected index
    > that way the Control A . child a's on change is fired... you can call a set
    > on Contol B. child a
    >
    > HTH
    >


    I realize that the onchange event is fired for a specific control. If I
    fire the event for one of the two controls by changing an item in the
    drop down list why can't I retrieve the changed value and pass it into a
    property of the second control which then selects the correct drop down
    list item in the second control? I thought that this is what I was doing
    and its not working. For some reason the second control doesn't get
    recreated after the postback with the new value selected.

    Regards,

    Aaron Prohaska

    -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
    Wrench Science Inc.
    http://www.wrenchScience.com/
    Phone: 510.841.4748 x206
    Fax: 510.841.4708
    -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
     
    Aaron Prohaska, Jan 9, 2004
    #3
  4. Hermit Dave

    Hermit Dave Guest

    Aaron,

    try using this.Parent
    it normally gets you the reference to the parent.
    using this.Parent.FindControl.

    Get hold of you PanelB. Do a FindControl on your second drop down list (DDL)
    once you get reference to the second drop down list you will then be able to
    set its selected index.

    --
    Regards,

    HD

    "Aaron Prohaska" <> wrote in message
    news:...
    > Hermit Dave wrote:
    >
    > > look you have
    > >
    > > Control (Panel) A having child control a and b (DDLs)
    > > Control (Panel) B having child contols a and b (DDLs)
    > >
    > > what you need to understand is that when the onchange event is fired its
    > > fired for either
    > > A.child a
    > > or
    > > B.child a
    > > you cant have just a child a event and expect it up update both.... they

    are
    > > different objects by themselves... the only reason you are not having a
    > > conflict is that they have two distinct containers... it Control A and
    > > Control B
    > >
    > > what you need to do is create public methods on child a which can get or

    set
    > > selected index
    > > that way the Control A . child a's on change is fired... you can call a

    set
    > > on Contol B. child a
    > >
    > > HTH
    > >

    >
    > I realize that the onchange event is fired for a specific control. If I
    > fire the event for one of the two controls by changing an item in the
    > drop down list why can't I retrieve the changed value and pass it into a
    > property of the second control which then selects the correct drop down
    > list item in the second control? I thought that this is what I was doing
    > and its not working. For some reason the second control doesn't get
    > recreated after the postback with the new value selected.
    >
    > Regards,
    >
    > Aaron Prohaska
    >
    > -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
    > Wrench Science Inc.
    > http://www.wrenchScience.com/
    > Phone: 510.841.4748 x206
    > Fax: 510.841.4708
    > -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
     
    Hermit Dave, Jan 10, 2004
    #4
  5. Hermit Dave wrote:

    > Aaron,
    >
    > try using this.Parent
    > it normally gets you the reference to the parent.
    > using this.Parent.FindControl.
    >
    > Get hold of you PanelB. Do a FindControl on your second drop down list (DDL)
    > once you get reference to the second drop down list you will then be able to
    > set its selected index.
    >


    Thanks for the help. I got this working by using a public method that I
    pass the string value that is to be the newly selected item.

    Regards,

    Aaron Prohaska

    -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
    Wrench Science Inc.
    http://www.wrenchScience.com/
    Phone: 510.841.4748 x206
    Fax: 510.841.4708
    -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
     
    Aaron Prohaska, Jan 12, 2004
    #5
  6. Hermit Dave

    Hermit Dave Guest

    you are welcome... glad i could help...

    --
    Regards,

    HD

    "Aaron Prohaska" <> wrote in message
    news:...
    > Hermit Dave wrote:
    >
    > > Aaron,
    > >
    > > try using this.Parent
    > > it normally gets you the reference to the parent.
    > > using this.Parent.FindControl.
    > >
    > > Get hold of you PanelB. Do a FindControl on your second drop down list

    (DDL)
    > > once you get reference to the second drop down list you will then be

    able to
    > > set its selected index.
    > >

    >
    > Thanks for the help. I got this working by using a public method that I
    > pass the string value that is to be the newly selected item.
    >
    > Regards,
    >
    > Aaron Prohaska
    >
    > -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
    > Wrench Science Inc.
    > http://www.wrenchScience.com/
    > Phone: 510.841.4748 x206
    > Fax: 510.841.4708
    > -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
     
    Hermit Dave, Jan 13, 2004
    #6
    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. Aaron Prohaska

    Syncronizing two instances of same control

    Aaron Prohaska, Nov 19, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    311
    Aaron Prohaska
    Nov 19, 2003
  2. REB
    Replies:
    0
    Views:
    337
  3. JG
    Replies:
    5
    Views:
    430
    Lawrence Kirby
    Feb 8, 2005
  4. adisps

    Syncronizing a list

    adisps, Dec 21, 2010, in forum: C Programming
    Replies:
    0
    Views:
    304
    adisps
    Dec 21, 2010
  5. Alex Maghen

    "Collision" in DropDownLists from two instances of same UserContro

    Alex Maghen, Jun 7, 2006, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    93
    Steven Cheng[MSFT]
    Jun 8, 2006
Loading...

Share This Page