Re: cannot fire up dropdownlist's SelectedIndexChanged

From: avnrao (avn_at_newsgroups.com)
Date: 06/09/04


Date: Wed, 9 Jun 2004 10:18:31 +0530

you said you are adding it as an attribute..
if you are doing this..
DropDownList1.Attributes.Add("onchange","alert(2);return;");
make sure that you should not have the return status after your javascript
executes. remove the RETURN from above line.

asp.net spits out the html like this..
<select name="DropDownList1"
onchange="alert(2);return;__doPostBack('DropDownList1','')"..
so having return on onchange would not fire post back.

Av.

"martin" <Stuart_REMOVE_36@yahoo.com> wrote in message
news:enxvwlbTEHA.1988@TK2MSFTNGP12.phx.gbl...
> try returning "true" from the dropdown list
>
> <select ddl... onchange="myevent();return true;"
>
> I noticed that I had to use this method on a checkbox that poste back.
>
> make sure that true is returne before the call to the .net generated
> javascript.
>
> HTH
>
> cheers
>
> martin
>
>
>
> "Daniel" <someone@yahoo.com> wrote in message
> news:OK6IGQbTEHA.2972@TK2MSFTNGP12.phx.gbl...
>> Yes, i've done that, but still cannot fire up, there is a javascript
>> onChange on this dropdownlist, i wonder it will affect this.
>>
>> Thanks.
>>
>>
>>
>> "Shaun C McDonnell" <mshaun@bellsouth.net-spammers-stop.now> wrote in
>> message news:%23nlWJgaTEHA.2128@TK2MSFTNGP09.phx.gbl...
>> > Set the AutoPostBack property to "true" on the DropDownList.
>> >
>> > Shaun
>> >
>> >
>> > "Daniel" <someone@yahoo.com> wrote in message
>> > news:%23Rf1ASaTEHA.204@TK2MSFTNGP10.phx.gbl...
>> > > Is there any other way can override this event, like javascript
> onchange
>> > > added to the attribute of this dropdownlist?
>> > >
>> > > Thanks
>> > >
>> > >
>> >
>> >
>>
>>
>
>



Relevant Pages

  • Re: [PHP] dynamic lists
    ... If you need a starting point, google for "javascript dynamic ... anything that uses onchange or onselect will cause ... The only way to accomplish this is using onclick ... That's typically a result of poor user requirements capture. ...
    (php.general)
  • Re: Display Text in Upper Case
    ... I am going to school this afternoon and I will try it. ... "Evertjan." ... with onchange and onkeyup the textcursor will be set to the ... I see you are in the wrong NG for Javascript. ...
    (microsoft.public.scripting.vbscript)
  • Re: Display Text in Upper Case
    ... I must have the educator enter some data as upper case. ... I have fought ... with onchange and onkeyup the textcursor will be set to the ... I see you are in the wrong NG for Javascript. ...
    (microsoft.public.scripting.vbscript)
  • Re: select onchange with typing in Webkit
    ... 'shoe' is selected, onchange does not fire ... should fire. ... Prototype.js was written by people who don't know javascript for people ...
    (comp.lang.javascript)
  • Re: onChange IE?
    ... var sel = document.createElement; ... sel.name='propRow' + iRow; ... Javascript is case sensitive, even if HTML isn't - so use onchange. ...
    (comp.lang.javascript)