ASP.NET Listbox and javascript?
-
actually what i want to do is that i have two list boxes. when i click any one one a particular item, the other listbox's same idex item should get highlighted too.. producing a list of listview effect ie. whenever an item is clicked on either of the listboxes, the sames index item on the other listbox will get highlighted too.. to test this i made the below code to see how to integrate javascript in asp.NET i made a list box and added a javascript function to it i made the listbox i added a javascript event to it on PageLoad lstFilter.Attributes.Add("onchange", "SelectPair(window.document.form1.lstFilter.options[selectedIndex].text);") then i wrote the javascript function : function SelectPair(window.document.form1.lstFilter.options[selectedIndex].text) { //lstvalue.select( window.document.Form1.lstFilter.options[selectedIndex].text = "hahahah" } but nothing is working....can u pls help.... tks a lot... "Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
-
actually what i want to do is that i have two list boxes. when i click any one one a particular item, the other listbox's same idex item should get highlighted too.. producing a list of listview effect ie. whenever an item is clicked on either of the listboxes, the sames index item on the other listbox will get highlighted too.. to test this i made the below code to see how to integrate javascript in asp.NET i made a list box and added a javascript function to it i made the listbox i added a javascript event to it on PageLoad lstFilter.Attributes.Add("onchange", "SelectPair(window.document.form1.lstFilter.options[selectedIndex].text);") then i wrote the javascript function : function SelectPair(window.document.form1.lstFilter.options[selectedIndex].text) { //lstvalue.select( window.document.Form1.lstFilter.options[selectedIndex].text = "hahahah" } but nothing is working....can u pls help.... tks a lot... "Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
Like This? I just put this page together for you. Is this the kind of thing you are looking for? Atul
-
Like This? I just put this page together for you. Is this the kind of thing you are looking for? Atul
Spanky3 wrote: I just put this page together for you. Is this the kind of thing you are looking for? Of course this is what he's looking for. Ask the question enough times and someone will do the work for him.
-
Spanky3 wrote: I just put this page together for you. Is this the kind of thing you are looking for? Of course this is what he's looking for. Ask the question enough times and someone will do the work for him.
-
Like This? I just put this page together for you. Is this the kind of thing you are looking for? Atul
but i cant view the aspx code... only the javascript... i wanted to learn about calling the javascript from aspx page.. "Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
-
but i cant view the aspx code... only the javascript... i wanted to learn about calling the javascript from aspx page.. "Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
Okey firstly you can never see asp,php,aspx code as this is the code the server uses to generate the pages. To create that page which i made. I simple dragged 2 drop down list boxes on a form... binded a an sql table and then set the event handler for "selection changed" and synchronised the selected index's ==================================== I dont understand what you mean about the calling javascript from the aspx page. aspx writes some javascript for the controls.
-
Okey firstly you can never see asp,php,aspx code as this is the code the server uses to generate the pages. To create that page which i made. I simple dragged 2 drop down list boxes on a form... binded a an sql table and then set the event handler for "selection changed" and synchronised the selected index's ==================================== I dont understand what you mean about the calling javascript from the aspx page. aspx writes some javascript for the controls.
i know i cant see that code...what i mean is can u paste the code here??:doh: "Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
-
actually what i want to do is that i have two list boxes. when i click any one one a particular item, the other listbox's same idex item should get highlighted too.. producing a list of listview effect ie. whenever an item is clicked on either of the listboxes, the sames index item on the other listbox will get highlighted too.. to test this i made the below code to see how to integrate javascript in asp.NET i made a list box and added a javascript function to it i made the listbox i added a javascript event to it on PageLoad lstFilter.Attributes.Add("onchange", "SelectPair(window.document.form1.lstFilter.options[selectedIndex].text);") then i wrote the javascript function : function SelectPair(window.document.form1.lstFilter.options[selectedIndex].text) { //lstvalue.select( window.document.Form1.lstFilter.options[selectedIndex].text = "hahahah" } but nothing is working....can u pls help.... tks a lot... "Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18
Joseph, 1. Your function is prototyped wrong. It should read something like this:
function SelectPair(text)
{
....
}2. Have you tried doing this instead?
lstFilter.Attributes.Add("onchange", "document.form1.otherFilter.selectedIndex = document.form1.lstFilter.selectedIndex");
Regards, Alvaro
"I do" is both the shortest and the longest sentence in the English language.
-
Joseph, 1. Your function is prototyped wrong. It should read something like this:
function SelectPair(text)
{
....
}2. Have you tried doing this instead?
lstFilter.Attributes.Add("onchange", "document.form1.otherFilter.selectedIndex = document.form1.lstFilter.selectedIndex");
Regards, Alvaro
"I do" is both the shortest and the longest sentence in the English language.
Alvaro Mendez wrote: 1. Your function is prototyped wrong. It should read something like this: function SelectPair(text) { ....} yea i did...doesnt affect anything... Alvaro Mendez wrote: . Have you tried doing this instead? lstFilter.Attributes.Add("onchange", "document.form1.otherFilter.selectedIndex = document.form1.lstFilter.selectedIndex"); yea.... doest work either.. "Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18