I'm having this issue where textbox A on my form is recalculated every
time textbox B, C, or D is changed. To complicate this, if dropdown D
= 1, for example, A = B + C, if dropdown D = 2, A = C * D. To do this,
Textbox B, C and D have autopostback set to True and depending on the
value of dropdown D, the appropriate formula is used. I also have
range validators on B, C and D to make sure the values are doubles in
the accepted range.
The problem is, the 'on change' postback fires even if the validators
finds an error. The validators display the error(s) but then the
postback happens and the page is rendered without any error messages.
Is there some way to specify that if the validator finds an error for
the textbox, then the autopostback should not happen?
I would hate to have to code the calculation or the validation in
javascript.
thanks 1 2472
Mad Scientist Jr wrote: I'm having this issue where textbox A on my form is recalculated every time textbox B, C, or D is changed. To complicate this, if dropdown D = 1, for example, A = B + C, if dropdown D = 2, A = C * D. To do this, Textbox B, C and D have autopostback set to True and depending on the value of dropdown D, the appropriate formula is used. I also have range validators on B, C and D to make sure the values are doubles in the accepted range.
The problem is, the 'on change' postback fires even if the validators finds an error. The validators display the error(s) but then the postback happens and the page is rendered without any error messages.
Is there some way to specify that if the validator finds an error for the textbox, then the autopostback should not happen?
I would hate to have to code the calculation or the validation in javascript.
thanks
Wrap up your 'on change' code with
if (Page.IsValid)
{
//only run if the validators are not 'tripped'
}
should always do this on event handlers when validators are involved, so
you don't have to worry about this scenario.
--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: KathyB |
last post by:
Hi, clearly I'm just not getting something here. I have an aspx form
with ONE textbox and several label controls on it.
I have the textbox set to AutoPostBack = True, but when I enter my
text...
|
by: Edward |
last post by:
I am having a terrible time getting anything useful out of a listbox
on my web form.
I am populating it with the results from Postcode lookup software, and
it is showing the results fine. What...
|
by: Mad Scientist Jr |
last post by:
I'm having this issue where textbox A on my form is recalculated every
time textbox B, C, or D is changed. To complicate this, if dropdown D
= 1, for example, A = B + C, if dropdown D = 2, A = C *...
|
by: TN Bella |
last post by:
Hi,
I am trying to get my compare validator to fire properly...Since I have
panels the validator wouldn't work properly, the app would fire right
but would insert the data regardless and the...
|
by: Wei |
last post by:
Hi,
I have a page written in ASP.net c# witch has a datalist with 200 records
(in Itemtemplate). Each record includes nine webcontrol radio buttons as a
group. The user will need to check...
|
by: tshad |
last post by:
I am trying to fire the CustomValidator when I leave the Email field.
Following is the code. It does PostBack, but the CustomValidator doesn't
seem to be firing.
<asp:TextBox...
|
by: sianan |
last post by:
I tried to use the following example, to add a checkbox column to a
DataGrid in an ASP.NET application:
http://www.codeproject.com/aspnet/datagridcheckbox.asp
For some reason, I simply CAN'T get...
|
by: =?Utf-8?B?Q2hyaXMgRy4=?= |
last post by:
I'm trying to put conditional code in a dropdown that would check the value
of the current ListItem and set Selected=true depending on that value, and
Selected=false if it's any other value.
Due...
|
by: indirareddy |
last post by:
Hai this Indira Reddy ................
If suupose not applied to dropdownlist autopostback true
it is working or not run time (server side)
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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,...
|
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...
|
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...
|
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...
| |