AJAX :: Enable / Disable Field Validation Using RequireFieldValidator And ValidatorCalloutExtender?

Feb 18, 2010

I am creating a fairly straight forward form for collecting data about vendors. I have a requirement that says the email address is required for a certain payment method and not other payment methods. The way I currently have this implemented is using a dropdownlist for the payment method and a TextBox for the email. I have been using ValidatorCalloutExtenders on all the other input fields with great success, but this is the first case where I need to be able to turn the validator and extender behavior on and off based on a selection of the dropdownlist.

I have tried many things and have searched these forums and google until my hands and eyes got tired, but have yet to find success, hence this post. I am aware of the dispose and $create methods, and that is currently what I am trying to do, but after the create occurs, while the behavior has been created, it doesn't seem like it has been created completely or something. To implement this, I am using a function tied to the onChange Event Handler of the drop down list. The function essentially checks the dropdownlist selection value and if it is NOT "ACH", then it finds the behavior attached to the requiredfieldvalidator attached to the email textbox and calls the dispose method on that behavior, if the selection value IS "ACH" then the method calls

$create(AjaxControlToolkit.ValidatorCalloutBehavior, { "closeImageUrl": "/VendorMaintenanceForm/WebResource.axd?d=IJFIM0l1l2KBLbEjcc5eS12jNidTRT60rU5Tz_Vg2CIJnYpw0GWOKDcVthhDzk9qkoREy7KswErAqM-kEQdJ5c18thtoit9YPZB3oq-EKdE1&t=633129167627987742", "highlightCssClass":
"HighLight", "id": 'emVal', "warningIconImageUrl": "/VendorMaintenanceForm/WebResource.axd?d=IJFIM0l1l2KBLbEjcc5eS12jNidTRT60rU5Tz_Vg2CIJnYpw0GWOKDcVthhDzk9qpoLKUlLQVCOCBk1mUhtC-YfwF57Tw0d676WGnnWiYI41&t=633129167627987742", "width": "300px" }, null, null,
$get("ctl00_MainContent_RequiredFieldValidator5"));

The reason I say this, is because once the page loads, the default value is to have the validator disabled, then if I select the payment method that enables the validator, it seems to work fine, but then if I cycle through the payment method choices again, I end up with a null pointer exception to the TextBox element when the validator is trying to apply the highlightCssClass on form validation. So, to summarize, it seems like when the page loads, things get built correctly, but then when I start doing the dispose and $create, things are recreated correctly so that when the submit button click causes validation, the validator throws a null pointer exception.

I know it can be hard to debug this sort of thing using words, but I was just wondering if I am going about this the right way or if there is an easier way to conditionally enable/disable a requiredfieldvalidator and validatorcalloutextender.

View 9 Replies


Similar Messages:

AJAX :: Hide Validation Message Of ValidatorCalloutExtender?

Jul 23, 2010

I am using AJAX ValidatorCalloutExtender for validation of a textbox, what i want is that on validation if the textbox is empty the validator callout should not show any message, it should only change the background color of textbox.

Is it possible to achieve this, if yes, how?

View 5 Replies

MVC :: Disable Submit Button On Post And Re-enable On Validation Error

Jan 25, 2011

so i figured out how to disable the submit button:

$(this).attr('disabled', 'disabled')

this works on firefox but not IE.

Also how can i check for validation error so i can enable the button.

View 1 Replies

Web Forms :: Enable And Disable Regular Expression Validation For Textbox

May 7, 2012

I having a two radio button. When the second radio button is enabled, a text box which accept the email id will appear. I am validating the Email using Regular expression validator.

When the second radio button is clicked, and I enter the invalid email id so that it shows me and error. But when I click the first radio button, it is  showing the save validation. I need this to not show the validation when the first radio button is clicked and invalid email id is there in the text box.

View 1 Replies

Web Forms :: Enable Disable Required Field Validator From Server Side (Code Behind)

May 7, 2015

In my web page I have a Checkbox (datatype = tinyint/boolean) and 2 Required field validator (whose visibility is false). I want that when I check(tick) the checkbox, then required field validator visible = true, else not.For this I tried this code on Page_Load as well as on save button click, but it is not working:

protected void Page_Load(object sender, EventArgs e) {
if (ChkComplexPass.Checked) {
Regex4.Visible = true;
Regex.Visible = true;

[Code] .....

View 1 Replies

Web Forms :: Enable Disable Required Field Validators Based On RadioButton Selection

Apr 17, 2012

I want to Enable Disable Required Field Validators based on RadioButton Selection using JavaScript

View 1 Replies

AJAX :: Enable & Disable Tab Panel?

Jan 9, 2010

I have a tab container and three panels

<cc1:TabContainer
ID="TabContainer1"
runat="server"[code]....

In my first panel I have a asp:checklistbox, which is dynamically loaded with items ....

Eg: [Code]....

One checkbox item = "Address"

Second checkbox item = "Work Info"

When User selects and clicks on first Checkbox option Address...the second Tab is enabled

When the User Clicks on Sec Checkbox option Work Info then the third Tab is enabled .else the tabs are disabled

I was working to use JQuery and unable to achieve this

My Jquery Part of the code is like above...looks a little too complicated

View 1 Replies

AJAX :: Enable Disable Particular MenuItem In Menu Control

Aug 8, 2013

How can I disable particular <menu item> tag in asp.net menu control, through code at runtime, according to session value??

View 1 Replies

AJAX :: Disable / Enable An Ajaxifeid Button From Client Side (JavaScript)?

Jun 22, 2010

disable / enable An Ajaxifeid Button From Client Side (JavaScript)?

View 3 Replies

AJAX :: Enable / Disable And Show / Hide Controls Outside Update Panel During AsyncPostBack

May 7, 2015

I am perform some action in update panel and there is a button to perform that action after perform that action, I want to show a button which is out side of update panel.

View 1 Replies

AJAX :: Menu Control With Dynamic Url / Set The Menu Items As Enable/disable In Two Different Modes Say Edit/new?

Feb 22, 2010

I need a help in creating a vertical oriented Menu control with dynamic url's set in there Navigate Url property.Also i need to set the menu items as enable/disable in two different modes say edit/new.

View 1 Replies

AJAX :: Disable Previous Date And Validation Calender Extender

May 24, 2010

I want to make sure user does not select a date earlier than today and also validate any validator i am using this code:

[code]....

View 1 Replies

AJAX :: MaskedEditValidator Outside Gridview Disable Delete Command In ItemTemplate Field

Jul 8, 2010

Something "weird" is happening with my ASP.NET application. I have a MasterPage with WebForms, and inside one of them, I have an ASP TextBox which is controlled by the MaskedEditExtender/MaskedEditValidator couple. Underneath, I have a GridView with 2 columns, an Edit ASP Command Field, an ItemTemplate which contains an ASP ImageButton with a Delete CommandName linked to a GridViewDelete Event through the OnRowDeleting attribute. The GridView is binded with SQL Server data while the page is loading.

It appears that once the page is loaded, if I want to delete a row by clicking on the ASP ImageButton, nothing appears. I have first to do something else with the GridView (raise an Edit Event for example), then it's accessible. I try different stuff to catch the source of the problem, and the "weird" part appeared when I deleted the MaskedEditValidator, just keeping the MaskedEditExtender : the Delete ASP ImageButton worked since the page loads!

View 2 Replies

AJAX :: Validation Text For Password Field Not Displayed

Feb 3, 2010

I'm trying to user ValidatorCalloutExtender on my login page but I'm having some trouble with it. I have two TextBoxes, two RequiredFieldValidators and two ValidatorCalloutExtenders. Here's my page's code:

[Code]....

So, my problem is quite simple, I guess. When the user press "ButtonLogin", the first ValidatorCallout is displayed requesting that the user enter his username. The validation text for the password field isn't displayed. If I enter the username and then try to post the form again, the validation text for the password isn't displayed at all. The text is displayed only after I click on TextBoxPassword. Is there any way to solve this? If I wasn't using ValidatorCalloutExtender, text for both validators would be displayed. So, I'm guessing that internally both validators actually trigger. The second isn't displayed because the first one is already been displayed. But even after entering text on the first textbox, the text doesn't come up. I believe it's still thinking that the first validator is been displayed.

View 2 Replies

Forms Data Controls :: Disable/Invisible Field In Gridview Based On Another Field?

Jul 9, 2010

I have 2 fields in my gridview one called ScriptType the other BagNo, when a user click the edit button, I would like the BagNo filed to be disabled if the ScriptType field is = "TTA" and enabled otherwise. How can I do this?..something along these lines see below..I am using VB..

[code]...

View 14 Replies

Web Forms :: How To Disable The Code Behind Validation When Javascript Validation Is Present

Jul 25, 2010

How can I disable the code behind validation when javascript validation is present? Then if there is no javascript enabled then the code behind validation will do its thing. What I notice is that it's reading the code behind valdiation not the javascript.

View 7 Replies

Enable / Disable Logging On?

Sep 15, 2010

I'm trying to create a setup in my ASP.NET website that allows me to enable/disable logging while the application is running at any point. I figure some of you have already done such a thing.

Here's the gist of what i'm trying to do:

if(ShouldBeLogging)
logger.Info("helloooooo there");

So how would you set up the boolean value ShouldBeLogging to be able to be turned on/off while the website is running without getting any serious performance drawbacks(seeing how its going to be accessed frequently)? I was thinking about putting something in the web.config, but wouldn't a change to that kick my user sessions if i wanted to turn it on?

View 3 Replies

MVC :: Disable And Enable Div Section?

Dec 19, 2010

I would like to disable or enable DIV section on asp.net MVC form :

if dropdownlist selected value ="Univ" then I enable div section else I disable div section

the div section to Disable and enable is EnableFacultéOrUfr

[Code]....

javascript function

[Code]....

View 7 Replies

Web Forms :: Textbox Enable And Disable?

Nov 15, 2010

using c# I am entering two types of string in a text box for eg "so-123456" or "12345678" only this two formats are allowed to enter, when i enter only 12345678 i.e, without "so" next textbox in that page should be enabled, if i enter "SO-123456" textbox should be disabled. without any click event i.e, while entering text in 1st textbox if it contains "so" textbox2 should be disabled, if textbox1 contains only integer(123456) textbox2 should be enabled.

View 1 Replies

Disable / Enable Button In Gridview?

Apr 13, 2010

I am using template field in a Gridview. I have a button in that. I also have a method which returns bool. Now I want to disable the button in the gridview if my method returns true. And enable the button if my method retuns false.

View 5 Replies

MVC :: Way To Enable And Disable CSS Based Session Value

Oct 5, 2010

I am rather new to MVC applications, and one thing I am trying to accomplish is enabling or disabling stylesheets based on a Session value.I have stylesheets referenced in my Site.Master page in this manner:

<%=Html.Stylesheet("~/styles/main.css", "string")%>
<%=Html.Stylesheet("~/styles/additions.css", "string")%>
<% if (Session["cssRule"] = "enableCss") { %>
<%=Html.Stylesheet("~/styles/main.css", "screen")%>
<%=Html.Stylesheet("~/styles/additions.css", "screen")%>
<%} %>

So if the 'cssRule' Session value is null, no CSS loads. Currently this is working fine, but it is not exactly what I am looking for. Right now I set the Session value in the Controller when the user logs in, but ultimately I need to set the value of theSession variable depending on if a user clicks the enable or disable button.

View 8 Replies

C# - How To Disable Or Enable Textbox In GridViewRow

Dec 14, 2010

I have a checkbox and a textbox in a GridView (for every row), and I'd like to be able to write some javascript that would enable and disable the textbox depending on the state of the checkbox (checked or unchecked). I guess I'd have to give JS the row index somehow.

View 3 Replies

C# - Enable Disable Tabs In A Tab Container?

Sep 1, 2010

I have a tab container in aspx page and i want to enable disable the last tab in aspx page my tab container is like below

[Code]....

Now for disabling the last tab i used the following in code behind page load:

//tabAdvanceSettings.Enabled = false;

I also want to enable this tab panel on client side when a user uses a shotrcut like Ctrl + Shif + A as shown below but this shortcut only enables the tab not the two user controls ptresent in the last tab. The code for enabling the last tab is :

if (e.keyCode == 65 && isCtrl == true && isShift == true) // Ctrl + Shift + A
{
$find('<%=tabContainer.ClientID%>').get_tabs()[2].set_enabled(true);
}

How can i enable the last tab and also the controls present in the last tab?

View 2 Replies

MVC :: Breadcrumb - Disable And Enable Actionlinks

Feb 22, 2011

I am developing a registration process in an MVC application. The process consists of 4 steps. I would like users to be able to see where they are in the registration process. i.e. I would like them to see a breadcrumb with each step displayed. If a user is on the first step, they should see all 4 steps displayed but only the first step should be enabled. If they are in the second step, they should only see the first and second steps enabled etc. The first link would take them back to the first step. I have considered using 4 action links to implement this. Is this the best way? If so, how do I disable and enable actionlinks?

View 6 Replies

Enable / Disable Any Record In Gridview ?

Nov 23, 2010

How to enable / disable any record in gridview ?using mssqlI want in my gridview the following will appear ..

Name Course Year Status
Sam MCA 2010 Enable

when i click on enable then record will be displayed in gridview and the enable button will convert into text disable... and when i click on disable then the record will be disable in gridview and enable button will appear ...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved