473,395 Members | 2,437 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,395 software developers and data experts.

Add Validation Control At Run Time

Can anyone tell me how to add a required field validator
control at run-time?

I have a form that the textbox controls are all added at
run-time. This all works fine.

When I add a validator control and associate it with the
textbox that was just added dynamically I get no errors,
but the validation does not take place on the server or
client side.

Is there some specail step I need to preform to wire up
the client side and sever side events? I have not been
able to find any example code showing the proper method to
perform this.

Thank you very much for the help,

Karl
Nov 18 '05 #1
2 2244
How are you doing it currently?

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Karl" <an*******@discussions.microsoft.com> wrote in message
news:0c****************************@phx.gbl...
Can anyone tell me how to add a required field validator
control at run-time?

I have a form that the textbox controls are all added at
run-time. This all works fine.

When I add a validator control and associate it with the
textbox that was just added dynamically I get no errors,
but the validation does not take place on the server or
client side.

Is there some specail step I need to preform to wire up
the client side and sever side events? I have not been
able to find any example code showing the proper method to
perform this.

Thank you very much for the help,

Karl

Nov 18 '05 #2
Teemu,

I wrote a demo to send you and it started working. I
think what I was doing wrong, was not supply all the
required properties. When I used the code below, all
works just fine.

Thank you,

Karl

rf = New RequiredFieldValidator
rf.Display = ValidatorDisplay.Dynamic
rf.ErrorMessage = "You must enter a value"
rf.Text = "*"
rf.ControlToValidate = "txt" + intX.ToString
rf.EnableClientScript = True
rf.Enabled = True
rf.EnableViewState = True
rf.ToolTip = rf.ErrorMessage
rf.Visible = True
rf.ID = "rf" + intX.ToString

-----Original Message-----
How are you doing it currently?

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Karl" <an*******@discussions.microsoft.com> wrote in messagenews:0c****************************@phx.gbl...
Can anyone tell me how to add a required field validator
control at run-time?

I have a form that the textbox controls are all added at
run-time. This all works fine.

When I add a validator control and associate it with the
textbox that was just added dynamically I get no errors,
but the validation does not take place on the server or
client side.

Is there some specail step I need to preform to wire up
the client side and sever side events? I have not been
able to find any example code showing the proper method to perform this.

Thank you very much for the help,

Karl

.

Nov 18 '05 #3

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

Similar topics

67
by: Scott Meyers | last post by:
I have a web site that, due to maintenance by several people, some of whom are fairly clueless about HTML and CSS, etc. (notably me), has gotten to the point where I'm pretty sure it's suffering...
7
by: Marina | last post by:
Imagine a form with some fields and an OK buttons that saves the information. Each field has validation logic in the Validating event. If the input is not valid, the control's value is replaced...
3
by: Rob Meade | last post by:
Hi all, I have a login page which has username and password fields, a login button, and 2 validation controls (one for each field) - currently I have controls to display to the summary if the...
6
by: Nedu N | last post by:
Hi, I want to have confirmation(Yes/No) on a button of the webform in which there are many validation controls. I want all the validation controls to be triggered first and then Yes/No...
3
by: Ben | last post by:
Hi, I have a page with a datagrid that you have to scroll to see. I'm using the StrengthControls SmartScroller as recommended to maintain my scroll position. Anyway, inside the datagrid I have...
9
by: AFN | last post by:
I was just dropped into someone else's code (isn't that always so fun?). I can't figure out why a custom validation control's server event function is executing. There is nothing (that I see)...
9
by: Bill Long | last post by:
I have a control that simply displays a list of links. Following one of the links doesn't post back or redirect to another page, it simply hides the current panel and shows the one you selected......
5
by: Tina | last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing validation elsewhere on the page. I want to specify that these buttons should not cause validation but they have no design...
2
by: Tim Frawley | last post by:
Source code attached indicates my problem with validation and a button bar save button. Fill the Textbox with some text then tab off the control. The message box will display the text in the...
1
by: Buddy Ackerman | last post by:
I don't know what the problem is. I have a form with several controls that need to be validated, I put a validation group in every form control, every validatoino control, the submit button and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...
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
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...
0
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,...

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.