I have the following:
<asp:textbox id="ProfileName " columns="45" runat="server" />
<asp:RequiredFi eldValidator
ControlToValida te="ProfileName "
Display="Dynami c"
Text="Name Required"
runat="server" />
I also have an imagebutton that goes to a routine to save a record
<asp:ImageButto n ID="SaveRecord " runat="server" Visible="true"
OnClick="Modify Record_Click" ImageUrl="../../buttons/SaveChanges_0.g if" />
I put nothing in the ProfileName field and it still goes to the function
ModifyRecord_Cl ick instead of displaying the "Name Required" message.
Why is it not working?
Thanks,
Tom 7 3562
I have a similar problem and wonder if this is like mine.
Are you having this problem in both IE and Firefox browsers ?
Are you prepopulating the field for the user to show the current value from
a datastore ?
"TJS" <no****@here.co m> wrote in message
news:uJ******** ******@TK2MSFTN GP15.phx.gbl... I have a similar problem and wonder if this is like mine.
Are you having this problem in both IE and Firefox browsers ? Are you prepopulating the field for the user to show the current value from a datastore ?
Actually,
It does it with both.
But I also was getting an error before in the function the button was
calling, so I assume the validator wasn't being called.
I assumed that because I got the error, the validator didn't work.
What is happening is that the function is being called after the Validator
has run?
I thought if there was an error, the function wouldn't be called. Am I
wrong here?
Thanks,
Tom
You're right, the function should not be called if the page is not valid
since it fails in both browsers, and you aren't prefilling the form, I would
need to see your code for "ModifyRecord_C lick" to determine of the problem
is there.
"TJS" <no****@here.co m> wrote in message
news:uN******** *****@TK2MSFTNG P15.phx.gbl... You're right, the function should not be called if the page is not valid
since it fails in both browsers, and you aren't prefilling the form, I would need to see your code for "ModifyRecord_C lick" to determine of the problem is there.
Actually, what I did to make it work is:
Sub ModifyRecord_Cl ick(sendor as Object, e as ImageClickEvent Args)
if not Page.isValid then
exit Sub
End If
I guessed the function does get called, so I just added that code to solve
the problem.
Tom
"tshad" <ts**********@f tsolutions.com> wrote in message
news:OS******** ******@TK2MSFTN GP09.phx.gbl... "TJS" <no****@here.co m> wrote in message news:uN******** *****@TK2MSFTNG P15.phx.gbl... You're right, the function should not be called if the page is not valid
since it fails in both browsers, and you aren't prefilling the form, I would need to see your code for "ModifyRecord_C lick" to determine of the problem is there.
Actually, what I did to make it work is:
Sub ModifyRecord_Cl ick(sendor as Object, e as ImageClickEvent Args)
if not Page.isValid then exit Sub End If
I guessed the function does get called, so I just added that code to solve the problem.
Tom
"tshad" <ts**********@f tsolutions.com> wrote in message
news:OS******** ******@TK2MSFTN GP09.phx.gbl... "TJS" <no****@here.co m> wrote in message news:uN******** *****@TK2MSFTNG P15.phx.gbl... You're right, the function should not be called if the page is not valid
since it fails in both browsers, and you aren't prefilling the form, I would need to see your code for "ModifyRecord_C lick" to determine of the problem is there.
Actually, what I did to make it work is:
Sub ModifyRecord_Cl ick(sendor as Object, e as ImageClickEvent Args)
if not Page.isValid then exit Sub End If
I guessed the function does get called, so I just added that code to solve the problem.
Now the problem is in my other routine, which is called by my LinkButton
(the Modify routine was called by an ImageButton).
The code is the same:
Sub DeleteProfile_C lick(sender as Object, e as EventArgs)
trace.warn("ins ide SelectProfile")
if not Page.isValid then
exit Sub
End If
But when I do it I get the error:
Page.IsValid cannot be called before validation has taken place. It should
be queried in the event handler for a control with CausesValidatio n=True or
after a call to Page.Validate.
So in the Modify function, the validate function is being called and in the
Delete function it is not ???????
Tom Tom
The method Page.Validate() is called automatically by each of Microsoft's
submit controls (Button, ImageButton, and LinkButton) unless you set
CausesValidatio n to false. If its not called, you cannot use Page.IsValid as
you've found.
The submit controls call it in their OnClick method (which then fires your
Click event handler). It runs after Page_Load.
- Make sure CausesValidatio n=true or you call Page.Validate() before calling
Page.IsValid
- Don't call any of this from within Page_Load. Let it happen in the post
back event methods.
- If you are using CausesValidatio n=false because you don't want to validate
every validator, call individual validator's Validate() methods. Then check
the IsValid property on those individual validators.
- This is all server side code. It should not be affected by the browser
type.
- It is possible that if javascript is not working, your Click post back
event will not run. This happens when your submit control calls
__doPostBack() on the client-side to set itself up for server side
processing. Without javascript running, __doPostBack() never runs.
--- Peter Blum www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at http://www.peterblum.com/vam/home.aspx
"tshad" <ts**********@f tsolutions.com> wrote in message
news:OF******** ********@TK2MSF TNGP14.phx.gbl. .. "tshad" <ts**********@f tsolutions.com> wrote in message news:OS******** ******@TK2MSFTN GP09.phx.gbl... "TJS" <no****@here.co m> wrote in message news:uN******** *****@TK2MSFTNG P15.phx.gbl... You're right, the function should not be called if the page is not valid
since it fails in both browsers, and you aren't prefilling the form, I would need to see your code for "ModifyRecord_C lick" to determine of the problem is there.
Actually, what I did to make it work is:
Sub ModifyRecord_Cl ick(sendor as Object, e as ImageClickEvent Args)
if not Page.isValid then exit Sub End If
I guessed the function does get called, so I just added that code to solve the problem.
Now the problem is in my other routine, which is called by my LinkButton (the Modify routine was called by an ImageButton).
The code is the same:
Sub DeleteProfile_C lick(sender as Object, e as EventArgs) trace.warn("ins ide SelectProfile")
if not Page.isValid then exit Sub End If
But when I do it I get the error:
Page.IsValid cannot be called before validation has taken place. It should be queried in the event handler for a control with CausesValidatio n=True or after a call to Page.Validate.
So in the Modify function, the validate function is being called and in the Delete function it is not ???????
Tom Tom
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: SStory |
last post by:
Is there no way to require a checkbox to be checked in ASP.NET?
The requiredvalidator control doesn't work for it--should I make a
server--roundtrip for that and check during the btn_click event? Is there
another way?
Thanks,
Shane
|
by: Martin Heuckeroth |
last post by:
Hi
We are working on a webservice application and are having some
problems with the cookies and/or sessions.
We have them working on our intranet but then its not working on the
internet. We have been looking our asses off but can not find a
working solution.
the code we came up with is ...
|
by: Elie Medeiros via .NET 247 |
last post by:
Hi there,
I have written a custom validator function to validate a datefrom a user-filled field. The function tries to parse the dateand if it can't, sets (serverValidateEventArgs)e.IsValid tofalse.
The twist is that it allows blank dates to be entered - viz,e.IsValid==true if the field is left blank. The idea is to usethat validation control to make sure the date a user has enteredis valid, without the date field being required to...
|
by: TJS |
last post by:
I am finding that the serverside requiredvalidator doesn't fire in the
firefox browser, and user request proceeds through to my updateProfile
method. Validation is working correctly in the IE browser.
Anyone seen this problem or have any ideas why this might be occurring ??
(I have web.config browsercaps updated from http://slingfive.com/ )
code:
=========
|
by: tshad |
last post by:
I have been working with setting my drop boxes to allow double clicking to
select an item.
It worked fine until I made some changes. I then stripped the page down to
the bare essentials to find out why it quit working. I found that if I
didn't have a linkbutton, it quit working?????????
If I changed the linkbutton to a regular button, it quit working.
Here is the page:
| |
by: jojobar |
last post by:
Okay, I am trying to do is to test the webresource in 2.0
1. I created a new project with assembly name (and default assembly name)
"Office".
2. I added the following to the AssemblyInfo.cs file (present under the
Properties folder of the project)
3. Now I created a file called test.js on the root folder of the project,
|
by: MSDNAndi |
last post by:
Hi,
I have a set of simple webservices calls that worked fine using .NET
Framework 1.0.
I am calling a Java/Apache based webservices, the calling side is not able
to supply a proper WSDL.
What it does is to call a webservice with two parameters, one being a
integer, the other one being a "String" which contains XML (not the best
practice, however that is the target interface and we cannot change that).
|
by: Shimon Sim |
last post by:
hi
It should be easy but I can't make it work.
I have DropDownList. I set first with text and value "Select". Then I add
RequiredValidator and set it InitialValue to "Select" and I expect that the
validator will not allow this value to stay the same but.. Validator never
fires.
What is wrong?
Thank you,
Shimon.
|
by: Niraj Sikotara |
last post by:
hello,
i'm using ASP.NET 2.0, and have placed validators on a page that are
not working correctly in FireFox (1.5.0.7)
the page can be downloaded from
http://ez-files.net/download.php?file=e0d71170
i've googled groups but not found any proper answer,
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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();...
| |
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...
| |