Syncronizing two instances of the same control

  • Thread starter Thread starter Aaron Prohaska
  • Start date Start date
A

Aaron Prohaska

I have been trying to figure out how to make the property values of two
instances of the same control synchronize during a postback and need
some help. I have posted an example of what I'm trying to do at this
address http://64.84.11.209/. I would really appreciate any help with
this. I'm actually surprised that no one else seems to be doing this or
having the same problem. The functionality I'm trying to make work I
think would be very beneficial to web sites.

Regards,

Aaron Prohaska

-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
Wrench Science Inc.
http://www.wrenchScience.com/
Phone: 510.841.4748 x206
Fax: 510.841.4708
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
 
In the selected index changed event for Menu1, just change the Menu2 to have
the same item selected. And vice versa.

Or is the problem something else?
 
create a public property which gets or sets the selected index and set the
selected value or pass the selected value... problem sorted :)
 
not the value... the index

--
Regards,

HD

Hermit Dave said:
create a public property which gets or sets the selected index and set the
selected value or pass the selected value... problem sorted :)
 
Hermit said:
create a public property which gets or sets the selected index and set the
selected value or pass the selected value... problem sorted :)

First of all, thank you both for the reply.

I think this is not working because there is something wrong with the
way my control is being rebuilt after the post back. I'm going to post
all the relevant code to http://64.84.11.209/ as a linked text file. If
you could take a look I would appreciate it.

Regards,

Aaron Prohaska

-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
Wrench Science Inc.
http://www.wrenchScience.com/
Phone: 510.841.4748 x206
Fax: 510.841.4708
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
 
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 ?

--
Regards,

HD

PS: couldnt concentrate on code long enough... but if you still have problem
2morrow... will step through it...
 
Hermit said:
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
 
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
 
Hermit said:
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
 
Hermit said:
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,

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.
 
Hermit said:
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
 
Back
Top