Access Textbox Properties In A Custom Validator?

Feb 10 10 at 19:19

I want to build a custom validator control that inherits from BaseValidator. It will only be used on textboxes in my application. How can I get access to the textbox itself (read properties of the textbox) within the custom validator?

Here is what I have in my EvaluateIsValid function:

Dim t As TextBox = CType(Page.FindControl(Me.ControlToValidate), TextBox)
Return t.Text.Length <= t.MaxLength

It can't seem to find the control, so it breaks with a null reference exception. Can I do this another way?


Custom Server Controls :: Access Properties Of Custom WebControl In ASPX Codebehind File?

Jul 19, 2009 05:59 AM

I have created a custom control that derives from WebControl class. I have defined a property called "ItemCount" in the custom control.

This custom control is created as a separate project and the assembly is added to the main web project (VS 2005 Web Site).

Just to test, I have only one line writer.Write("Hello World!") in the overriden "RenderContents" method in the web control.

Once added to the aspx file, the control renders the text perfectly fine and is declared in the aspx file as

<cc:mycontrol ID="_testControl" runat="server"/>

Now, when I try to access the control "_testControl" in the codebehind, I cannot compile and I get the error as "The name '_testControl' does not exist in current context.

After reading multiple posts, I tried declaring the control in my aspx codebehind as

protected MYControl _testControl;

This comes out to be NULL during run-time. I'm not too familiar with, but if other controls (e.g. Button, Textbox) are accessible in my codebehind including their properties, should the same logic be not applied to WebControls...they are all the same!

I can create a new instance of the _testControl in the OnInit method, but that defeats the whole purpose. I need to understand what is going on and what is the right way to solve it.

View 1 Replies View Related

Web Forms :: Client Side Custom Validator Changing Textbox Values?

Mar 19, 2010 08:23 PM

I've been working on a task to add a validator to compare the values of two text fields in a ASP.NET 1.1 application.

It uses validators already, so the best approached seemed to involve a CustomValidator. I was inspired by the following example:


I got the server side validation working - now I'm trying to add some client-side validation but I'm having a strange issue.

When I click in either of the two text fields, the value of the txtFinalGrade field is overridden to either "true" or "false". I've been having a tough time tracking down the code that's causing this. I tried using the IE Developer Toolbar to trace the script - as well as FireBug in Firefox (though this is an IE-only app) and I'm still trying to figure out what's causing this to happen.

Since I think this is a JavaScript issue, I'm posting that part of my code:


Anyone have ideas of things to try? Anyone have similar issues with textboxes being set to true/false when working with custom validators?

View 3 Replies View Related

C# - How To Access Attributes Of Properties In The Model From Strongly Typed Custom HtmlHelper

Mar 18 at 4:27

I have a view that is strongly typed and its model is of type LogOnModel. That LogOnModel has anotated properties like this one:

[Required(ErrorMessage = "Please enter your password")]
[Display(Name = "Password", Description = "Your secreet password")]
public string Password { get; set; }

All of them has Display anotation with Display.Descripion property set. I want to create HtmlHelper extension method that will output <span> containg the value of Display.Description property. So for example if I called my extension method DescriptionFor than this code:

<%: Html.DescriptionFor(m => m.Password) %>

should produce following html: <span>Your secreet password</span>

View 1 Replies View Related

C# - Load A User Control In An Ajax WCF Service And Access Custom Properties?

Apr 4 at 16:23

I can load a generic user control just fine in my WCF service doing the following:

UserControl userControl= (UserControl) new Page().LoadControl("~/UserControls/MyControl.ascx");

However i can't seem to find any way to do this

MyControl myControl=(MyControl)userControl;

The reason i need to do this is because my user control has a custom property, person, I need to do the following:

myControl.Person=new Person();

essentially i need to simulate:

<%@ Reference Control="~/UserControls/MyControl.ascx" %>

which normally goes inside page or master-pages.any way of doing this in an Ajax Enabled WCF Service?

View 2 Replies View Related

How To Create The Custom Validator Instance That Is Linked To The Custom Validator

Dec 17, 2010 10:47 AM

I created my custom validator in one project, something like that:


he composite control in another project. I added a reference of the custom validator project to the composite control project. I have a textbox in a composite control and I would like to validate this textbox by the composite control I created. But how can I do that? How can I create the custom validator instance that is linked to the custom validator I created?

View 1 Replies View Related

Custom Server Controls :: User Control Can't Access The Parent Pages Public Properties

Feb 27, 2008 05:29 PM

I have built a page that is contained within a master page and it holds 2 user controls

Control A contains a DataList

Control B contains a FormView

I want to pass the selected index from the DataList on Control A to the FormView on Control B so it acts like a master / detail scenario

I created a public property on the page that contains both controls called DataListSelectedIndex A also created a public property for DataListSelectedIndex on the Control I populate the DataListSelectedIndex property of the Control when the DataList_SelectedIndexChanged event is fired And I populate the DataListSelectedIndex property of the page on the OnLoad event of the page.

My problem is that on Control B - (or Control A for that matter) I can't access the public property DataListSelectedIndex

The method I am trying to access this is through - this.Page on the OnLoad even of the Control

View 6 Replies View Related

Forms Data Controls :: Access Textbox Text Properties When Gridview Edit Mode

Jun 16, 2010 12:48 PM

Is it possible to access textbox text properties from codebehind when gridview is edit mode? for example I can access label's text properties on gridview row databound event.


So I do not like use Text='<%#Eval("ColumnName")%' this method. I want to manage textbox text properties dynamcily codebehind when click the edit button on gridview. When I clik the edit button these code blocks runs


but rowdatabound event fires again and couldn't find label control. It looks for textbox control to bind data but I can not manage this step.

View 1 Replies View Related

Does A Custom Validator Have To Be Used With The Validator Callout Extender

Jul 06, 2010 11:01 PM

I have a validator callout extender that works, it shows the callout box. But, it does a postback. It didn't do a post back the first time I clicked the button but it did for subsequent times. I read on the AJAX site that a custom validator must be used with this for it to work. I'm currently using this with a required field and regular expression validator. It works, the callout appears, but it doesn't work every time with out the post back.I posted this to see if there is a way to get this to work with a required field and regular expression validator, with out using a custom validator. I'm using the newest release of the toolkit, so I thought the documentation may be old, since the callout is appearing.

View 8 Replies View Related

Custom Server Controls :: Custom Validator Client-side Validation Cannot Work?

Jan 13, 2010 11:11 PM

I've been trying to get a custom validator component working that ensures at least one checkbox from a checkboxlist has been checked. I've been used some code I found on but the client-side validation didn't work. I've been attempting to modify it to get the client-side javascript validation to work with no luck. Basically, I compile the below code into a DLL and add it to my bin folder.


View 2 Replies View Related

Custom Server Controls :: Custom Required Field Validator?

Sep 25, 2009 02:52 AM

I have a custom TextBox and a Custom RequiredFieldValidator. The custom RequiredFieldValidator inherit from RequiredFieldValidator. In the custom TextBox I have a Boolean property called "Required". So if this property is set from the MarkUp I will create an instance of the CustomRequiredFieldValidator in the custom TextBox class. Every thing is working fine except that I am unable to figureout where and how to check the IsValid property of custom RequiredFieldValidator.

Also I am unable to figure out that why protected override bool EvaluateIsValid() is not executing.Please note that I have set all the required properties in the constructor of custom RequiredFieldValidator calss as following


I also placed an Asp Button with CauseValidation="true"; but still the page post back is not occuring. Also the click event of the Button is not executing. What I understand that all this validation is happening on the client side.

my objective is to execute some Business Logic based on either the user has entered value in the custom Textbox or not.

View 4 Replies View Related

Custom Server Controls :: Binding Properties Of A Custom Control In A ListView?

Jul 06, 2009 08:06 PM

I have a custom control derived from CompositeControl that I'm using in the EditItemTemplate and InsertItemTemplate of a ListView. The ListView's data source is an ObjectDataSource.

I use <%#Bind('fieldname') %> to bind the properties of my custom control. I have found that the data will be displayed in my custom control, but when I try to update or insert, the data is not retrieved. I checked the onitemupdating event and saw that NewValues.Count was zero.

Does my custom control need to implement somthing special in order to return its data?

View 4 Replies View Related

Custom Server Controls :: Custom Control And Properties Window?

Jun 01, 2010 12:37 PM

I have made a composite control that has 1 Label Control ,1 TextBox ,1 button and 1 Panel Control. Below is my code:

namespace ServerControl1


The above code compiles without any error. Also I can drag and drop this control from the Toolbox of my Project on my web form. However I am unable the change the value of my fromLabel control.It allows me to change the value in the properties window.But when I run the form it always shows me its default value which is "From". I want it to be flexible so that any one can change the value in the properties window.

View 3 Replies View Related

Custom Server Controls :: Why Custom Gridview Control Not Render HTML Properties Under Properly In Visual Studio 2005

Mar 05, 2010 01:50 PM

Why custom Gridview control not render html properlies under <Columns> properly in Visual Studio 2005?

For example:


View 1 Replies View Related

Custom Server Controls :: Custom Control's Constructor / User To Set That variable In The Properties Window After They Drag The Control Onto A Form?

Mar 04, 2010 03:56 PM

I have a custom control which inherit from the Table class and in the constructor, it takes a an integer as an argument. There is no empty constructor.

Is there a way for the user to set that variable in the properties window after they drag the control onto a form.

I know some .NET controls, you can set the source for the parameter to different things like another control's property, QueryString using just the properties window.

Right now, I have to create the control dynamically. I read the query string and then created the object.

View 1 Replies View Related

Web Forms :: Best Example For Custom Validator

Dec 18, 2009 09:38 AM

best example for custom validatorhow can we use..i know that but iam not getting it clearly

View 2 Replies View Related

Set Width Of Custom Validator

Feb 11 10 at 22:53

Does anybody know of a way to set the width of a custom validtor so that the error message text will wrap if it exceeds the specified width? I have a user control that contains a custom validator which the containing page can set the error message on based on specific validation results. he user control sits within a table cell in a page. If the message is very long it simply prints the entire message on a single line ignoring any column widths that are set. I have tried setting the width property on the custom validator itself to no avail.

View 2 Replies View Related

MVC :: How And When Custom Model Validator Is Used

Apr 29, 2010 07:56 PM

I am trying to understand a little more about implementing a custom model validator. I have implemented a custom model validator (derived from DataAnnotationsModelValidator<T>) for my custom validation attribute in order to do validation on the client side as well. There is not much documented about DataAnnotationsModelValidator. Besides, implementing client-side validation when is it a good idea or needed to implement a custom model validator for a custom attribute?

A separate question - in trying to understand how and when a custom model validator is used by the framework I noticed that my custom validator is always created with the context (2nd parameter in DataAnnotationsModelValidator<T>'s constructor) being a ViewContext, although it is declared as ControllerContext. Will a validator ever be created with something else than a ViewContext, and if so, when?

View 2 Replies View Related

Custom Validator Not Validating Correctly?

Mar 16 09

In the following code I have a dropdownlist and text box, what I'm trying to achieve is when an item from the dropdownlist is selected it needs to make sure the textbox is not null before page IsValid, if not Page is not valid, what I'm getting is Page is valid is textbox is null and not valid is textbox if populated. I'm new to this and cannot figure out why this is happening

<%@ Page Language="C#" %>
<form id="Form1" runat="server">
<asp:DropDownList ID="editStatusTextBox" runat="server"
CausesValidation="True" >
<asp:ListItem Selected="true" Value="Call Attempt 1" Text="Call Attempt 1"/>
<asp:ListItem Value="Call Attempt 2" Text="Call Attempt 2"/>
<asp:ListItem Value="Contacted - Interested" Text="Contacted - Interested"/>
<asp:ListItem Value="Contacted - Not Interested" Text="Contacted - Not interested"/>
<asp:ListItem Value="Callback Required" Text="Callback Required"/>
<asp:ListItem Value="Not in Business" Text="Not in Business"/>
<asp:ListItem Value="Number not in use" Text="Number not in use"/>
<asp:ListItem Value="Using alternative product" Text="Using alternative product"/>
<asp:ListItem Value="Nurture" Text="Nurture"/>
<asp:TextBox id="editCallBack"
<script runat="server">
void Button1_Click(Object sender, EventArgs e)
if (Page.IsValid)
Label1.Text = "Page is Valid";
Label1.Text = "Page Not Valid";
void ValidateNumber(object source, ServerValidateEventArgs args)
if ((Eval(editCallBack.Text) == null) && this.editStatusTextBox.Text == "Call Attempt 1")
args.IsValid = false;
else if ((Eval(editCallBack.Text) == null) && this.editStatusTextBox.Text == "Call Attempt 2")
args.IsValid = false;
catch (Exception ex)
args.IsValid = false;
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="editCallBack" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
<asp:CustomValidator id="CustomValidator1"
runat="server" ControlToValidate="editCallBack"
ErrorMessage="You must enter a Date"
<asp:Button id="Button1" onclick="Button1_Click"
runat="server" Text="Button"></asp:Button>
<asp:Label id="Label1" runat="server"></asp:Label>

View 2 Replies View Related

Custom Validator Not To Trigger On The First Button?

Feb 10, 2010, 00:11

I have two buttons on my page, the first page is View Button and the second is Update Button. View button display's member's personal profile. If I click on the view button, my custom validator automatically trigger, meaning, it automatically displays the error message. Whereas, the custom validator must trigger if I click on the Update button. How am be able to deal with this kind of problem.

View 6 Replies View Related

Web Forms :: Custom Validator Is Not Getting Called?

Jan 20, 2011 10:51 AM

here is the code "when i select a value from calender customvalidator is not called . . "


View 7 Replies View Related

Web Forms :: Calling A Custom Validator

May 12, 2010 08:40 PM

I have a custom validator, which I have set a property for, and I can access this validator from my MVC controller method. However, when I run the code, I am not seeing the error message on the page. My code in the controller method looks like this:

If (!bool)
this.view.customValidator.IsValid = false;
this.view.customValidator.Visible = true;

View 2 Replies View Related

Web Forms :: Error While Using Custom Validator?

May 06, 2010 06:21 AM

I am using Customvalidator control . I am giving client side validation function in it. On running it is giving error as: ValidationStream is not defined.

Following is the code:

<asp:CustomValidator ID="CustomValidator6" runat="server" ClientValidationFunction="validateDriveDate"

View 2 Replies View Related

Determine Which Custom Validator Will Fire First?

Feb 10 10 at 1:11

I have two custom validators that are in the same validation group. This validation group is launched by one button. My question is, in what order will the custom validators fire in? It appears that the validator that is placed earlier in the aspx page fires first, but I don't want to rely solely on this.

View 2 Replies View Related

Web Forms :: Custom Validator Is Not Working In Ie6?

Feb 09, 2011 01:00 PM

<asp:TextBox ID="txtMobile" runat="server" MaxLength="11"></asp:TextBox>
<ajaxToolkit:FilteredTextBoxExtender ID="fteMobile" runat="server" TargetControlID="txtMobile"
FilterType="Numbers" />


View 2 Replies View Related

C# - How To GetProfile By Custom Properties

Mar 9 at 19:58

<profile enabled="true" automaticSaveEnabled="false">
<add name="InvitationCode" type="String"/>

How to get profiles with InvitationCode="foo"? Also can i make property unique?

View 1 Replies View Related

Custom Validator For MaxLength Property Of Textarea

May 16, 2010 12:42 PM

I have quite a few text area's on my page and am wanting to limit the number of characters for each one. However each one should be able to have its own maxlength (i.e. one could be 20 characters and the other could be 100 characters). My validation on the page is all done using custom validation as the built in validation of .NET is not extensible enough for me to display my validation errors how I want to display them. So this is what im wanting to do:

Make a custom validatorPass a MaxLength value from the custom validator into the javascript function, this value must also be accessible from the code behindI can then run client side and server side validation on each textbox control. The problem I am having is passing a MaxLength value to client side script and to server side. Is there a property on custom validators which I can use to pass values around? For instance in Javascript I would want the value of the MaxLength and also the id of the Div which will show the characters remaining, and server side I would need to know the MaxLength. I have done lots of research on this and cannot seem to find an answer.

View 8 Replies View Related

Web Forms :: Custom Validator Text Cannot Disappear

Aug 10, 2010 11:19 AM

I have a form with textbox for name and two dropdownlist for month and years. Textbox has Requiredfieldvalidator and the dropdowns has got ustomvalidator.Initially when i dont enter anything in the text box and leave the dropdowns with default "MM" for month and "YYYY" for year i get error message in the validation summary at top and asterisk next to the textbox and dropdowns. Once i enter some text in the textbox and focus is away from textbox the asterisk disappears but even though i hav selected a valid month and year the asterisk next to the dropdowns is not disappearing. Same problem with the radio buttons.

View 5 Replies View Related

Web Forms :: How To Write Custom Validator For DropDownlist

Jan 25, 2011 05:51 AM

In my page i have DropDownlist.I want to write Custom validator.How to write?

View 3 Replies View Related

Checkbox Custom Validator With ValidationSummary Not Working?

Jan 25 at 10:51

I have the following validation which is working fine for the rest of my fields, but trying to get a custom validator to work as part of the validation summary for a checkbox but no joy.

This is what I have at the moment

<script language="javascript" type="text/javascript">
function ValidateTandCs(source, args)
args.IsValid = document.getElementById('<%= optIn.ClientID %>').checked;
<asp:ValidationSummary CssClass="highlight"
HeaderText="<p>Please amend these errors below to continue with your
application.</p>" Runat="server" />
<asp:CheckBox id="optIn" runat="server"></asp:CheckBox> I agree to the terms and
conditions of this site and I wish to Opt In for registration.
<asp:CustomValidator ID="valTandCs" ClientValidationFunction="ValidateTandCs"
ValidationGroup="ValidationSummary1" runat="server"
ErrorMessage="Please accept Terms and Conditions before submitting.">

But when I click submit I only see the error messages for my other fields and nothing for this checkbox..

View 1 Replies View Related

Comparing Two Date Format Using Custom Validator

Dec 14, 2010 09:41 AM

How to compare tow date in format using custom validator and else. I have java script function like as. I want to call this function by using custom validator as

< </ asp:CustomValidator id="CustomValidator2" runat="server" ControlToValidate = "tbMyDate1"
EnableClientScript="True" Display="Static" ClientValidationFunction="Compare" SetFocusOnError="True" >asp:CustomValidator>
function { document.getElementById( Compare()"lblrefdate").innerText="";var m_names = new Array(
var { { dispMM=i+1; } }
dispDD=dispdate .value.split("-")[0];var s1=dispdate.value.split("-")[1];var
dispMM;var i=0;for(i=0;i<=m_names .length ;i++)if(m_names [i]==s1) var { {
refMM=j+1; } } dispYY=dispdate .value.split("-")[2];var
refdate=document.getElementById("tbMyDate1");var refDD=refdate.value.split("-")[0];var
s2=refdate.value.split("-")[1];var refMM;var
j=0;for(j=0;j<m_names .length ;j++)if(m_names[j]==s2)var
refYY=refdate.value.split("-")[2]; if {
} (isNaN (refYY))"lblrefdate").innerText=""; else { { { { {
} if(refYY<=dispYY)if(refMM <=dispMM )if(refMM==dispMM)if(refDD <=dispDD )"lblrefdate").innerText="";else { document.getElementById(
} } } "lblrefdate").innerText="Ref Date can Not Be Grater then Disp Date";else {
document.getElementById( } }
"lblrefdate").innerText="Ref Date can Not Be Grater then Disp Date";else
document.getElementById( { } } }
"lblrefdate").innerText="Ref Date can Not Be Grater then Disp Date";

View 2 Replies View Related

C# - Custom Validator Firing But It Does Not Update The ValidationSummary

Nov 29 10 at 21:54

I am working on a custom form field validator, it seems like the custom validator is working by not allowing it to continue to the next page, but it doesn't update the Validation Summary nor does it display the asterisk and the labels that i've made visable. I also have other validators like RequiredFieldValidator on the same field. My ValidationGroup is set, as is the Text and IsValid. I even wrote and set a dummy client side validation method in javascript as some workarounds suggests.

here is the validation summary code in


View 1 Replies View Related

Custom Validator Dynamic ServerValidate Using Reflection

Jul 4 10 at 19:56

I have a UserControl which contains a TextBox and a CustomValidator. I would like to set the CustomValidator.ServerValidate to a method in the page that contains the UserControl I found this code which will allow me to dynamically set the custom validators validation function: cusvCustom.ServerValidate += new System.Web.UI.WebControls.ServerValidateEventHandler(MethodName);

The problem is that a string value won't work there. It needs to be a reference to the method. Is it possible to use reflection (or some other method) to get a valid reference to the parent controls method using only the string name of it? The reason I want to use the string value of the method name is so I can place the control on the page thusly: <uc1:TextBoxField ID="tbUserName" runat="server" CustomValidationMethod="ValidateUserName" />

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl.ascx.cs" Inherits="WebApplication1.WebUserControl" %>
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Custom Validation Failed" OnServerValidate="CustomValidator1_ServerValidate" />
<asp:TextBox ID="TextBox1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Submit" CausesValidation="true" />
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
public partial class WebUserControl : System.Web.UI.UserControl
public ServerValidateEventHandler Validating;
protected void CustomValidator1_ServerValidate(object sender, ServerValidateEventArgs e)
if (Validating != null)
Validating(sender, e);
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPage.aspx.cs" Inherits="WebApplication1.TestPage" %>
<%@ Register Src="~/WebUserControl.ascx" TagName="WebUserControl" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
<form id="form1" runat="server">
<uc1:WebUserControl ID="WebUserControl1" runat="server" OnValidating="WebUserControl1_Validating" />
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
public partial class TestPage : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
//WebUserControl1.Validating += WebUserControl1_Validating;
protected void WebUserControl1_Validating(Object sender, ServerValidateEventArgs e)
e.IsValid = false;

I did some research and I found Type.GetMethod and MethodInfo but I can't get them to work. Primarily because I don't know the type of the parent control and can't figure out how to get it. EDIT: My code for matt-dot-net. As you can see it's almost an exact duplicate of your code. For whatever reason it does not work for me as I have it here. When I click on the button the page reloads and is the same. When I un-comment the one line though and click the button then I see the error message.

View 1 Replies View Related

WCF / ASMX :: WCF Username Authentication With A Custom Validator?

Feb 18, 2011 05:25 AM

how to implement WCF username authentication with a custom validator in both client side and server side. I am trying this since last 2 days. but no result.

View 7 Replies View Related

No Error Message Displayed For Custom Validator?

Nov 3 10 at 22:50

I have a requirement that one of multiple fields is required. Using custom validator the even fires, false is returned, but no error message is display and the form validates. What am I missing? I have tried with and without ValidationSummary.

<asp:CustomValidator ID="CustomValidator1" OnServerValidate="validatePhone" EnableClientScript="false" runat="server" ErrorMessage="Home or Cell Phone is Required" ></asp:CustomValidator>
<asp:ValidationSummary ID="ValidationSummary1" DisplayMode="BulletList" runat="server" ForeColor="Red" Font-Size="X-Small" Font-Bold="true" />
protected void validatePhone(object sender, ServerValidateEventArgs e)
e.IsValid = string.IsNullOrEmpty(txtCellPhone.Text) && string.IsNullOrEmpty(txtHomePhone.Text) ? false : true;

View 3 Replies View Related

Web Forms :: Custom Validator - Valid Number?

Mar 12, 2010 06:14 PM

I am using C# for ASP .NET 2.0. On my web form I have a TextBox that I want to let the end-user type inside of. The rules are as such: They should only be allowed to type numbers and a decimal. No negative numbers allowed. The number has to range from 0.00 to 24.00 - for hours - and can only allow for quarter hours - example: 0.00, 0.25, 0.50, 0.75, 1.00, 1.25, etc. Do I need a custom validator for this? If so, I do I check to see that the number is valid?

View 5 Replies View Related

Web Forms :: 2.0 - Wizard - StepNavigationTemplate And Custom Validator

Aug 30, 2006 10:24 AM

I have a well-debugged page with wizard control where "Next" and "Previous" buttons are generated by control itself, without template. One of steps contains custom validator shown below:


It's not so important what exactly does it do, moreover as I will show below, it works allright. So, at the moment when we press "Next" button, if this validator tells that data is wrong, Wizard doesn't go to the next step and stays at the same step exactly as it should. Perfect! But today I decided to change Navigation Bar with buttons from standard view, and instead of automatic one I inserted that template (btw, generated by Studio itself, I've just a bit edited it):


[:O] Everything stopped to work! To be more specific - I found after some tests that my validator is called as usual. Moreover, it honestly sets "false" to its' args.IsValid! But ASP.NET ignores it and wizard with no doubt goes to the next step! One .aspx file (I'm not touching .cs one even!). Doesn't work -> just delete <StepNavigationTemplate>...</StepNavigationTemplate> section, check -> everything works ok. Return it back -> nothing is working again. I'm "dazed and confused" (c) What I have to do to force it work the right way?

View 13 Replies View Related

Ajax - Custom 'Type' In Compare Validator?

Oct 19 10 at 11:07

How to reset date Type for Compare Validator in ASP.Neti am using the dd/MM/yyyy format for the Calendar Extender of a textbox, where as Compare Validater looks for MM/dd/YYYY how to change date format of Compare Validator.

View 1 Replies View Related

C# - Cross Page Posting & Custom Validator?

Mar 5 10 at 16:57

I use a Custom Validator (which validates on the server) and a button (it's PostbackUrl = "Page2.aspx").

When I press the button the browser show always Page2 without checking if the page is valid.

View 1 Replies View Related

Web Forms :: Can't Have Multiple Instances Of A Custom Validator

Feb 08, 2011 04:11 PM

I have the current block of code inside an OnPreRender method of a validator that is inheriting from BaseValidator. If I have one instance of the validator this works fine, but if there are multiple instances the javascript flakes out. As it stands the acutal evaluation function has to be rendered on a per instance basis. I know it's kind of a drop in the bucket, but I'd like to register the block below just once instead of giving each instance a unique key to register with.


View 3 Replies View Related

Copyrights 2005-14, All rights reserved