Monday, March 26, 2012

ListBox Question For ajax guru....

ok, I may be pushing the limits of whats possible with the ajax listbox, but I'm curious...

Is it possible to populate one listbox with the SELECTED contents of another listbox. ie I have a list box of many subjects the user can select, I want all the subjects the use selects to populate the 2nd listbox, then in the 2nd listbox the user can select a primary subject.

The roadblock I see with this is that that the asp:listbox control doesn't have an onclientclick property,

this could be easily achieved a server side function that chose the selected index from listbox1 and added and item to listbox2 (using ajax).

refer my article.

i have used dropdownboxes for this.

http://www.codeproject.com/Ajax/dropdown_box_using_ajax.asp


Thanks for the quick reply. I was actually curious if there was a way to do this with ASP AJAX rather than a full blown Javascript implementation.


bbaxter:

The roadblock I see with this is that that the asp:listbox control doesn't have an onclientclick property,

I guess you already have an idea about how to achieve what you need if this property is available. As far as I know, you can use onchange event for the list to get a similar function.

To add it, you may use the following code: ListBox1.Attributes.Add("onchange", "a function");

Hope this helps.

No comments:

Post a Comment