473,769 Members | 5,877 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I cancel OnSelectedIndex Changed ?

Hi.
I have a DataGrid with a DropDownList, like this:
<asp:DropDownLi st id="ddlStatusCo de" OnSelectedIndex Changed="SetDir ty"
runat="server"> </asp:DropDownLis t>
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 OnSelectedIndex Changed event?

Thanks,
Shawn
Nov 23 '05 #1
3 4232
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.RegisterHi ddenField
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:DropDownLi st id="ddlStatusCo de" OnSelectedIndex Changed="SetDir ty"
runat="server"> </asp:DropDownLis t>
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 OnSelectedIndex Changed 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****@NOSPAMd evelop.com> wrote in message
news:b8******** *************** ***@msnews.micr osoft.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.RegisterHi ddenField 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:DropDownLi st id="ddlStatusCo de" OnSelectedIndex Changed="SetDir ty"
runat="server"> </asp:DropDownLis t>
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 OnSelectedIndex Changed 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****@NOSPAMd evelop.com> wrote in message
news:b8******** *************** ***@msnews.micr osoft.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.RegisterHi ddenField
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:DropDownLi st id="ddlStatusCo de"
OnSelectedIndex Changed="SetDir ty"
runat="server"> </asp:DropDownLis t>
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 OnSelectedIndex Changed 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
6586
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
1502
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 which aspx page is holding the user control, the name of the method to be called when this event fires is different, so I want to pass the name of the method to the DDL via a public property of the User Control.
6
7771
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 update the database. Here is the control containment hierarchy: ASP Page Static User Control // just provides a pretty border around
6
2073
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 class of mine that I subclassed from Page. I have overridden a couple of methods (OnPreRender, OnUnload, OnInit) to provide for html template layout, all of the base functions are called as well. Can anyone lend some help as to why the...
1
4440
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, and placed it outside of the DataList and it fires the event just fine. So it's definitely to do with it being in a template. I've managed to reproduce the issue on a small test app, the code and html is below:
2
16101
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 in my asp tag as shown here: <asp:DropDownList id="ddlTo" runat="server"
1
1871
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 couple of weeks ago and it updated ActiveX "stuff" in IE. I'm not sure if the update has effected IE or there's something wrong with mt .net application. I have a simple DDL. It calls a sub when the value in the DDL is changed. Now, when I change...
0
2822
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. What happened is if I select cancel on my confirmation button, it executes the griedview postback which i assigned in my code behind. Please see my codes below... Code beind: protected void gvDefectCatalog_RowDataBound(object sender,...
3
12515
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 get checked when the ProductID is a member of that Category, otherwise it is unchecked. A user may also check or uncheck a category checkbox then save. The problem is, if a user forgot to save before changing the ComboBox, then his changes on the...
1
9999
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3570
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.