473,386 Members | 1,621 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,386 software developers and data experts.

ValidationProperty

Hi !

I have a problem with a Web User Control who does not trigger the
RequiredFieldValidator Control...

I created a Web User COntrol who contain a TextBox. I created a property
to obtain and set the Text property of the TextBox, making it visible
outside of the control. I called this property "Text". (Originality,
Welcome)

Here's the code of the property :

[Bindable(true)]
[Description("Obtain or set the value insode the TextBox")]
[Category("Appearance")]
[DefaultValue("")]
public string Text
{
get
{
EnsureChildControls();
return this.txtDate.Text;
}
set
{
EnsureChildControls();
this.txtDate.Text = value;
}
}

Next, I wanted to be able to validate my control, wiwh means he can
trigger the validation controls (RequireFieldValidator,
RegularExpressionValidator,...)

I modified the declaration of my class to this :

[DefaultProperty("Text")]
[ValidationProperty("Text")]
[Designer(typeof(Designers.DatePickerDesigner))]
[ToolboxData("<{0}:DatePicker runat=server></{0}:DatePicker>")]
[ToolboxBitmap(typeof(System.Web.UI.WebControls.Tex tBox))]
public class DatePicker : System.Web.UI.WebControls.WebControl

The problem is every single validation controls works fine (Compare,
RegularExpression, Range, Custom), except the RequiredFieldValidator...

Anybody has an idea ?
--

Sébastien Decoux
Nov 16 '05 #1
1 6889
I can bring new data... My control is validated, but only server-side
(the RequiredFieldValidator is the only Validation Control who doesn't
trigger client side on my control)... As my control is located on a form
containing other validators triggerd Client side, this is annoying to
have the error message displayed only after the PostBack.

Could these new data give ideas to someone ?
Sébastien Decoux wrote :
Hi !

I have a problem with a Web User Control who does not trigger the
RequiredFieldValidator Control...

I created a Web User COntrol who contain a TextBox. I created a property
to obtain and set the Text property of the TextBox, making it visible
outside of the control. I called this property "Text". (Originality,
Welcome)

Here's the code of the property :

[Bindable(true)]
[Description("Obtain or set the value insode the TextBox")]
[Category("Appearance")]
[DefaultValue("")]
public string Text
{
get
{
EnsureChildControls();
return this.txtDate.Text;
}
set
{
EnsureChildControls();
this.txtDate.Text = value;
}
}

Next, I wanted to be able to validate my control, wiwh means he can
trigger the validation controls (RequireFieldValidator,
RegularExpressionValidator,...)

I modified the declaration of my class to this :

[DefaultProperty("Text")]
[ValidationProperty("Text")]
[Designer(typeof(Designers.DatePickerDesigner))]
[ToolboxData("<{0}:DatePicker runat=server></{0}:DatePicker>")]
[ToolboxBitmap(typeof(System.Web.UI.WebControls.Tex tBox))]
public class DatePicker : System.Web.UI.WebControls.WebControl

The problem is every single validation controls works fine (Compare,
RegularExpression, Range, Custom), except the RequiredFieldValidator...

Anybody has an idea ?


--
Sébastien Decoux
Nov 16 '05 #2

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

Similar topics

2
by: Danny | last post by:
I created a function to test to see if entered text has a '.' in it, The code seems to work but the validation always fails even when 'true' is returned. i put = myfunction in the validation...
3
by: Mike Dole | last post by:
I experimented with a usercontrol (TagedTextbox), I added a tag property. The tag value however is not persisted on postback (text value's fine)? I worked around it with: Me.ViewState("tag")...
2
by: Yuri Vanzine | last post by:
I am applying the ValidationProperty property to a modified custom control that I am using: public class ComboBox : System.Web.UI.WebControls.ListControl, IPostBackDataHandler,...
4
by: Mike | last post by:
I'm having a problem which I thought would be a very simple thing but is turning out to be a difficult challenge. I have a web form with several input fields and I have a single checkbox, not a...
2
by: Martin | last post by:
I am writing a custom validator by extending CustomValidator in order to validate three fields as follows: If checkbox true then textboxA and textboxB must have data in. The problem I am...
3
by: David Davis | last post by:
I cannot get a web user control to validation client-side using a required field validator. It only validates server side. I have a web user control in .net 2.0. I have a single text box on it....
4
by: kevin | last post by:
Hi, I am trying to create a page so the user can browse the network, select a file and have that file name (text) inserted into our sql DB so I can build the hyperlink path later on. Here's what...
1
by: Andrew Robinson | last post by:
Is it possible to have a RequiredFieldValidator that targets a UserControl? <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="PhoneUserControlHome"...
7
by: mc | last post by:
I've not been able to get a Check box to client side validated on postback. with my changes I can get it to work on the serverside ok but not on the client. I have created a new control as...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.