473,761 Members | 5,163 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 4230
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
6584
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
1501
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
7770
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
2071
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
4439
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
1870
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
2821
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
12514
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...
0
9522
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10111
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9765
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
8770
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...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.