469,645 Members | 1,684 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

Syncronizing two instances of the same control

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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
Nov 18 '05 #1
12 1260
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?

"Aaron Prohaska" <NO*************@verdesoft.com> wrote in message
news:bt**********@nntp2-cm.news.eni.net...
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-

Nov 18 '05 #2
create a public property which gets or sets the selected index and set the
selected value or pass the selected value... problem sorted :)

--
Regards,

HD

"Aaron Prohaska" <NO*************@verdesoft.com> wrote in message
news:bt**********@nntp2-cm.news.eni.net...
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-

Nov 18 '05 #3
not the value... the index

--
Regards,

HD

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:eH**************@tk2msftngp13.phx.gbl...
create a public property which gets or sets the selected index and set the
selected value or pass the selected value... problem sorted :)

--
Regards,

HD

"Aaron Prohaska" <NO*************@verdesoft.com> wrote in message
news:bt**********@nntp2-cm.news.eni.net...
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-


Nov 18 '05 #4
Hermit Dave wrote:
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
Nov 18 '05 #5
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...

"Aaron Prohaska" <NO*************@verdesoft.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hermit Dave wrote:
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-

Nov 18 '05 #6
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
Nov 18 '05 #7
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" <NO*************@verdesoft.com> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-

Nov 18 '05 #8
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
Nov 18 '05 #9
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
Nov 18 '05 #10
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" <NO*************@verdesoft.com> wrote in message
news:eA**************@TK2MSFTNGP12.phx.gbl...
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-

Nov 18 '05 #11
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
Nov 18 '05 #12
you are welcome... glad i could help...

--
Regards,

HD

"Aaron Prohaska" <NO*************@verdesoft.com> wrote in message
news:u9**************@TK2MSFTNGP09.phx.gbl...
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
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-

Nov 18 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Blazej Czeladzki \(ByCZy\) | last post: by
3 posts views Thread by Vivek Sharma | last post: by
reply views Thread by Aaron Prohaska | last post: by
reply views Thread by Rob Smeets | last post: by
reply views Thread by Bob Harrison | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.