Link to home
Start Free TrialLog in
Avatar of MiBlg
MiBlg

asked on

ASP.NET Clientside Linked Dropdown Listbox

Hi,

Could someone teach me how to implement a linked Dropdown listbox.  What I mean here is that a value for one listbox will determine the list of another listbox, but It doesn't do any postback to the server, ie it's performed on clientside.  

For example, there is two dropdown list box. One is a Product Category Listbox, another is a Product Listbox. If user select a value in the Product Category Listbox, say it's A, then Product listbox will show all products belongs to A category. However, the action doesn't generate any roundtrip to the server. It's performed on clientside.

How to achieve that in ASP.NET?

Thanks for any help

MI
Avatar of vo1d
vo1d
Flag of Germany image

think that this will not work.
you will need to make a javascript which will change the listbox data, cause javascript is execute on the client.
c# code is executed on the serversite.
mfg
vo1d
Avatar of landerd
landerd

Look at www.metabuilders.com
He has some really good java based client side controls.
Avatar of MiBlg

ASKER

Yes, I need some sort of javascript on the clientside but how to create such a script and output it from the C#
Thanks
ASKER CERTIFIED SOLUTION
Avatar of landerd
landerd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you have to pass your script to the HttpContext.Current.Response object

so except i wanna pass a little javascript which opens a messagebox i would have todo the following:


HttpContext.Current.Response.Write("<script type=\"text/javascript\">\n<!--\nalert(\"testpopup\");\n//-->\n</script>\n");

remember that the html code has to have control chars for newline etc  like \n.
but if you write \n to a string first, it will be interpreted as newline and will not be \n.
so you would have to use the @ before your string.
hope this will help
vo1d
Avatar of MiBlg

ASKER

vo1d thanks for your suggestion, but I found landerd's comment is really useful.
Avatar of MiBlg

ASKER

landerd, that site gives me what I'm looking for and even more!

Thanks a million

MI