473,386 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How can I cancel OnSelectedIndexChanged ?

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
Nov 23 '05 #1
3 4209
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.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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

Nov 23 '05 #2
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

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:b8**************************@msnews.microsoft .com...
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.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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


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

-Brock
DevelopMentor
http://staff.develop.com/ballen
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

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:b8**************************@msnews.microsoft .com...
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.

-Brock
DevelopMentor
http://staff.develop.com/ballen
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

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Susan van Houen | last post by:
Hi All, How do I intercept an autopostback on the client side and prevent it from executing the submit? In classic ASP I used to intercept the on_submit and just return false;
0
by: Jon Maz | last post by:
Hi, I have a user control which contains a DropDownList, and I want to be able to set the OnSelectedIndexChanged method of the DDL in the User Control from the holding aspx page. Depending on...
6
by: DotNetGruven | last post by:
I have a webform that has a DataGrid on it with a RadioButtonList in each row. It is a simple On & Off. When the User Clicks on either of the RadioButtons, I need to postback to the server and...
6
by: srallen | last post by:
I have a simple page that has a dropdown with autopostback=true and onselectedindexchanged is set to a function that never gets called (checked during debug). This page is subclassed from custom...
1
by: Paul L | last post by:
Hi, I have an issue with the OnSelectedIndexChanged event not firing for a DropDownList control which is in the ItemTemplate of a DataList. I have made an exact copy of the DropDownList control,...
2
by: glenn | last post by:
Hi folks, I am trying to determine which item in a DropDownList Web control has been selected. I have posted an OnSelectedIndexChanged subroutine in my code with a reference to the subroutine...
1
by: Groove | last post by:
I have a strange problem. It seems that for some reason, a OnSelectedIndexChanged event is no producing an error in IE6. What concerns me is that I just performed that large Windows update a...
0
by: Eraser | last post by:
Hi to all .NET guru guys... I have a problem in my delete button inside gridview. How to avoid postback on when i select cancel on confirmation message? But postback is okay on Ok confirmation....
3
by: almisba7 | last post by:
Hi, I have a ComboBox that contain ProductIDs and a DataGridView that lists Categories which a product can be a member of. My DataGridView list ALL categories, however, it has a checkbox column that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.