473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Syncronized DropDonwList!

Hi boys,
i hope you can help me...i'm italian!

I've 3 dropdownlist in an asp.net web page and c# in the codebehind.
Every dropdownlist have 10 elements.

I'd like using Ajax to change in a synchronized way the index of
dropdownlists.
For example, if i click the second dropdonwlist and i select the index
number 3, i'd like that also the first and the third dropdownlist will
change and positioning int the same index element.

Help me please! Thank u! :)
Oct 7 '07 #1
2 1124
"tranky" <NO****@GRAZIE.itwrote in message
news:47***********************@reader3.news.tin.it ...
I've 3 dropdownlist in an asp.net web page and c# in the codebehind.
Every dropdownlist have 10 elements.

I'd like using Ajax to change in a synchronized way the index of
dropdownlists.
For example, if i click the second dropdonwlist and i select the index
number 3, i'd like that also the first and the third dropdownlist will
change and positioning int the same index element.
Well, AJAX is probably overkill for such a task, since it could be more
directly accomplished by means of simple javascript, without needing to
communicate with the server. But if you still want to use Microsoft AJAX and
server-side code, do the following:

Add a ScriptManager Control and an UpdatePanel to the aspx page. Place
the three dropdownlists inside the UpdatePanel. Set to true the AutoPostBack
property in the three dropdownlists. Connect the SelectedIndexChanged event
of DropDownList1 to this routine:

void DropDownList1_IndexChanged(Object sender, EventArgs e) {
DropDownList3.SelectedIndex=DropDownList2.Selected Index=DropDownList1.SelectedIndex;
}

This will cause the second and third listboxes to adopt the same position
as the first one when this one changes. You can repeat the preceding with
dropdownlist2 and 3 so that changing any of them will chage the other two.

Be careful with your Page_Load: if you are loading the three
dropdownlists here, make sure that you are doing it inside an "if
(!IsPostBack)", otherwise you will reload the dropdowns on every postback
and this will lose you the SelectedIndex, so the indexchanged events will
not work as expected.

Oct 7 '07 #2
thank u very much!!
Oct 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Vinay Aggarwal | last post by:
I have been thinking about the lazy initialization and double checked locking problem. This problem is explain in detail here http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html...
0
by: Jason Gyetko | last post by:
I have a software application with an Access front end and an Access backend to house the data. Recently I converted the backend to MySQL. The Access frontend works fine connecting to the MySQL...
1
by: Danny | last post by:
Hi, I have a windows application in .net. In that application I have two forms. The first form calls my second form. In the second form I have to run a process whn it is called and show to the...
0
by: Amos | last post by:
I have the following tables: table GROUPS: ID_GROUP (Contatore) (CP - chiave primaria) GROUP (Testo) DESCRIPTION (Testo) table ACCOUNTS: ID_ACCOUNT (Counter) (PK) ID_GROUP (Number) (EK -...
28
by: Michael Primeaux | last post by:
What is the recommended pattern for implementing a synchronized (thread-safe) class that inherits from Collection<T>? For example, I want to implement a SyncRoot property . I do see where I can...
10
by: gerry | last post by:
Is there any way to specify that all methods of a class should be synchronized other than applying the attribute for every method ? Gerry
6
by: fniles | last post by:
I am using VB.NET 2003 and a socket control to receive and sending data to clients. As I receive data in 1 thread, I put it into an arraylist, and then I remove the data from arraylist and send it...
1
by: xzzy | last post by:
1 - namespace myNS 2 - {internal class clsClass 3 - { 4 - SortedList mySL1 = new SortedList(); 5 - SortedList mySL = SortedList.Synchronized( mySL1 );
0
by: diff | last post by:
I am having trouble preventing a bound source from updating using event-driven validation. There is a very nice article on MSDN explaining this;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.