473,326 Members | 2,023 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,326 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 2006
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...
3
by: AG | last post by:
Below is code (slightly modified and converted to VB) that was provided to me in response to another post. I am using it to demonstrate another problem. In order for paging and other features to...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.