473,398 Members | 2,404 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,398 software developers and data experts.

RequiredFieldValidator and Cancel Button

Mvk
Hi;

I have a simple aspx form. I have put a textbox and 2 buttons on it. The
textbox is linked to a requiredfieldvalidator.

Click on button 1 (= ok button) = Store value in textbox in database.
Click on button 2 (= cancel button) = Redirect with
Response.Redirect("AnotherPage.aspx")

Now I have the following problem. When I click on the "Cancel"-button the
the browser is not being redirected to "AnotherPage.aspx" but instead the
RequiredFieldValidator is complaining...

What I want is: When pressing on the cancel-button the browser does not have
to do the RequiredField check on the textbox!

Any Idea ?

Regards!
MVK
Nov 18 '05 #1
3 5548
Is the Cancel button set to CausesValidation="False"?

<asp:Button id="Button2" runat="server" Text="Cancel"
CausesValidation="False"></asp:Button></P>
"Mvk" <ma****@c3.be> wrote in message
news:40*********************@news.skynet.be...
Hi;

I have a simple aspx form. I have put a textbox and 2 buttons on it.
The
textbox is linked to a requiredfieldvalidator.

Click on button 1 (= ok button) = Store value in textbox in database.
Click on button 2 (= cancel button) = Redirect with
Response.Redirect("AnotherPage.aspx")

Now I have the following problem. When I click on the "Cancel"-button the
the browser is not being redirected to "AnotherPage.aspx" but instead the
RequiredFieldValidator is complaining...

What I want is: When pressing on the cancel-button the browser does not
have
to do the RequiredField check on the textbox!

Any Idea ?

Regards!
MVK


Nov 18 '05 #2
Try set the CauseValidation property of the cancel button to False

Bin Song, BCP
Nov 18 '05 #3
Do you really need to perform a server round-trip for your redirection? If
not, why not simply redirect on the client? e.g. (instead of your current
cancel button):

<input type="button" value="Cancel"
onclick="window.location.href='AnotherPage.aspx';" >
"Mvk" <ma****@c3.be> wrote in message
news:40*********************@news.skynet.be...
Hi;

I have a simple aspx form. I have put a textbox and 2 buttons on it.
The
textbox is linked to a requiredfieldvalidator.

Click on button 1 (= ok button) = Store value in textbox in database.
Click on button 2 (= cancel button) = Redirect with
Response.Redirect("AnotherPage.aspx")

Now I have the following problem. When I click on the "Cancel"-button the
the browser is not being redirected to "AnotherPage.aspx" but instead the
RequiredFieldValidator is complaining...

What I want is: When pressing on the cancel-button the browser does not
have
to do the RequiredField check on the textbox!

Any Idea ?

Regards!
MVK

Nov 18 '05 #4

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

Similar topics

3
by: Mvk | last post by:
Hi; I have a simple aspx form. I have put a textbox and 2 buttons on it. The textbox is linked to a requiredfieldvalidator. Click on button 1 (= ok button) = Store value in textbox in...
3
by: RSB | last post by:
Hi every one , i am creating this form and i have two asp:Linkbuttons one for save and one for Cancel. Now i also have some RequiredFieldValidators on this Form and i only want to Execute...
4
by: James | last post by:
Hello, I have a RequiredFieldValidator for several textbox controls on a form. Here's an example with the RequiredFieldValidator. EnableClientScript, Enabled, and Visible are set to true for...
2
by: Dave | last post by:
Hello. I have the web form where user can input some data in textboxes, I'm validating user input with RequiredFieldValidator controls, then I have two buttons "OK" and "Cancel". Now when I...
5
by: Fernando Lopes | last post by:
Hi. I want to show an image in a requiredfield validator instead of "*". So, I 'm set the requiredfieldvalidator attributes like following: <asp:RequiredFieldValidator id=rfvFirstName...
5
by: Hazz | last post by:
I needed to provide client side validation for a web forms text box, radio button list, and drop down list. I asked two developers I work with what they thought I should do. One said Javascript,...
2
by: Hongbo | last post by:
Hi, I have a Asp.Net written in C#. It serve as information input form. The form encounters sort of random problem with the email field and state field. I have validator attached with these 2...
0
by: MatsL | last post by:
If I create a simple form with a panel a textbox and button and a RequiredFieldValidator for the textbox. I define the default button on the panel. When i open the form and press enter i get a...
3
by: Bogdan | last post by:
Hi, I have a OnClientClick script assigned to a button. From the script, I'd like to check if RequiredFieldValidator attached to a textbox on the page has failed. The Page_IsValid works fine...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...
0
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...
0
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...

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.