In my registration webpage,5 textboxes with required and regular expression validators.click register button means it show all validators properly but suppose click cancel button means it remove the text in all textboxes watever filled.but it showing the validators to fill all the textboxes after filled values in all textbox it allow to remove all text in textboxes otherwise wont...how to do this?
set CausesValidation="False" on the cancel button
Related
I have a clear button and save button ,when i press clear button the required field icon gets clear as the button gets postback,i dont want this to happen i want to show the icon even after clear button is clicked.
You have to specify validation group attribute name for the save button, and set this name on required field validation control
ValidationGroup="validation_name"
I have two buttons on my page and I want to trigger validator for only one of them not both.
first button is in masterpage.
second one in the page.
I do not want the first button trigger RequiredFieldValidator I set UseSubmitBehavior="False" button it does not work for me
Validation Groups allows to apply the validations for a group of controls. It works especially when there are multiple buttons on a page and if one button should trigger validations for set of controls and other button for another set. It can be achieved by setting validationgroup property to some string value on the validator controls along with button control.
I have a textbox and a button with an onClick event connected to it, and when the button is clicked once I want to change the text of the button and clear the textbox. How can i accomplish this?
If you want to do this on a postback (a complete refresh of the page), simply put code in your button click handler to set these values. For example, textbox.Text = string.Empty;
If you want to set it on the client side (without refreshing the page), then you'd need to use client script such as JavaScript.
This needs you to know about TextBox and its properties. Normally the value of a textbox you use its Text property as TextBox1.Text. In your case you put this statement in the button's click event
string txtValue=TextBox1.Text;
TextBox1.Text=string.Empty;
To see how to use TextBox and its properties. This can help
if i have multiple submit buttons and the user enters some text in a textbox and presses enter. How can i specify which button event i want to fire?
You can specify for an asp.net Panel the id of button in the property DefaultButton. So, you need to group the controls into panels and then you can specify the default button for any of them. Also, you can specify a default button for the whole page - in the form tag.
i am developing a site in asp.net as front-end
In my Form,
i have a 3 text-box with validation control on it eg: requiredFieldValidator
with joinnow button. and search button with 2 textbox with no validation control on it
when i click on search button it is asking me to fill the three text box for validation and it is not redirected to other page
i need that when i click on search button my form should redirect
You need to set the ValidationGroup properties on your textbox that has the validation and the joinnow button to the same thing. When you click the button it will validate controls in its group, and thus not validate from the search button (which is in a different validation group implicitly)
solution for it is
set the property of the search button as below
CausesValidation="False"