473,659 Members | 2,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom Control and RequiredFieldVa lidator.Display

Hi all,
I´m having a little trouble with a requiredfieldva litor in a custom control. I put a validator in runtime, as this code:

protected override void OnInit(EventArg s e)
{
if (this.Validatio nRequired)
{
reqField = new RequiredFieldVa lidator();
reqField.Contro lToValidate = this.ID;
reqField.Text = "&nbsp;&nbsp;<i mg src=\"http://localhost/Extra/Images/Structure/exclamacao.gif\ ">";
reqField.Enable ClientScript = true;
reqField.Displa y = ValidatorDispla y.Dynamic;
Page.Validators .Add(reqField);
}

}

Ok, this goes to my page fine. But there, in debug mode, I´ve notice that the Display property of my validator is always Static, and not Dynamic, like reqField.Displa y = ValidatorDispla y.Dynamic instruction. In my page load I´m doing this to see:

foreach (BaseValidator b in Page.Validators )
{
b.Display = ValidatorDispla y.Dynamic;
}

Anyone can help me? I don´t know what else to do.

Thanks!

André Nobre
Jul 27 '06 #1
0 1268

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

Similar topics

10
1914
by: dale zhang | last post by:
Hi, I saw the post here about setfocus. But they are for web form. Web control page HTML does not have form1. the Jscript there does not work here. My question is how to set focus to the text box in web control page?
5
1754
by: John Saunders | last post by:
Is this ok? I haven't seen any examples of it, but it looks like it should work: <asp:requiredfieldvalidator id="valreqUserName" runat="server" controltovalidate="txtUserName" errormessage="Please enter the user name"> <span title="Please enter the user name"> <img src="../../images/bullet.gif"> </span>
5
3103
by: Grant Harmeyer | last post by:
I have an application that uses FreeTextBox 2.0 (http://www.freetextbox.com). FreeTextBox is a rich text editor that behaves similarly to MS Word. The FreeTextBox control has a button to insert images (just as you would with MS Word) and it works beautifully. The problem is that when you include an image with the rich text editor, the image path is the local path on the client. I have written a method that examines the text for <img> tags,...
1
3101
by: Lloyd Dupont | last post by:
I have a composite control rougly like that:: ==== class BlogComments : Control, INamingContainer, IPostBackEventHandler { Panel pAddComment; TextBox tTitle; protected override void CreateChildControls() { pAddComment = new Panel();
2
1876
by: PeterKellner | last post by:
I'm wanting to just show the error in a ValidationSummary control, not next to the actual TextField I'm putting a RequiredFieldValidator next to. I don't even want the little "*" showing which field it is. (strange requirement, but that's the way it is). I've found that if I set the attribute Text="" (zero length string), it always uses the ErrorMessage instead of Text. I need the ErrorMessage because that is what is going to show up...
1
1103
by: Miguel Isidoro | last post by:
Hi all, I am developing a Custom ASP.NET Server Controls that generates a form based on a xml file and want to include RequiredFieldValidator for mandatory questions. I am using the following function: private RequiredFieldValidator CreateRequiredFieldValidator(string controlToValidateID, string errorMessage) { RequiredFieldValidator requiredFieldValidator = new
4
4736
by: Steven Nagy | last post by:
Hi all, I have a custom user control in an ASP.NET app (.NET 2.0). This control needs a public property called "ControlToValidate" which accepts strings. I need to be able to declare it much as you would with a validator control, like this: <asp:Textbox id="myTextbox" runat="server" /> <uc1:MyControl id="mc1" runat="server" ControlToValidate="myTextbox" /
0
1201
by: mayankagarwal | last post by:
Over the last few days i have read a lot of forum about custom validator not working or not firing etc. I am stuck in a similar situation and of all the solutions i have come across they dont seem to be working for me. I have a contact us form on my site (ASP.NET, AJAX, VB) and I need to validate the textbox input on most of the inputs i have use requiredfieldvalidator, expressionvalidators and they all work alright. What i also need to do is...
4
1834
by: Jeff | last post by:
hi asp.net 2.0 I have created a custom web control, here is it's header: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="EditUserBox.ascx.cs" Inherits="Controls_EditUserBox" %> In another custom web user control, I use this web control: <%@ Register Src="~/Controls/EditUserBox.ascx" TagName="Eub" TagPrefix="mb"
0
8330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8626
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6178
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.