Javascript in ASP.net page

  • Thread starter Thread starter Poppy
  • Start date Start date
P

Poppy

I have 2 .net radio buttons on my page.

When the user clicks a button I want to change the contents/source of a drop
down box on my page without doing the round trip to the server.

E.g.

If radio button 1 clicked then
call poDropDown1()
else
call dropdown2()
End if

Can anyone point me in the right direction ?
The dropdown must be populated from 1 or other of the .net methods.

Thanks in Advance
 
you could potentially write your own javascript and add it to the page using
Page.RegisterClientScriptBlock

you can either hardcode the onClick="javascript:myfunc();" in your aspx
page...
or you can user
chkOpt1.attributes.Add("onClick", "javascript:myfunc();"); to the same
effect from code behind

HTH
 
You can certainly do this with JavaScript. However, you should be aware that
because of ViewState issues, changing the contents of a drop-down Server
Control on the client side without doing a PostBack may cause some
unexpected results/issues.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top