How can I cancel OnSelectedIndexChanged ?

S

Shawn

Hi.
I have a DataGrid with a DropDownList, like this:
<asp:DropDownList id="ddlStatusCode" OnSelectedIndexChanged="SetDirty"
runat="server"></asp:DropDownList>
If the user selects a new value I set a flag on the row in the SetDirty
method so that I know the row has been changed. My problem is that now I
have to change the value of the DropDownList myself using a javascript, but
I don't want the SetDirty method to set a flag on the row. Can I use a
javascript to somehow cancel the OnSelectedIndexChanged event?

Thanks,
Shawn
 
B

Brock Allen

You should then pass another post variable letting your server code know
it was the javascript that changed the value, not the user. Check out Page.RegisterHiddenField
to create a new hidden field for the flag.
 
S

Shawn

Thanks Allen,
I've already solved it by using session to set a new flag, but I was hoping
there was a way to cancel the event without having to set a new flag.

Shawn
 
B

Brock Allen

Nope, there's not really since all the server knows is that the posted value
is now different than the previous value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top