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

Custom Server Control Does Not Cause Validation

I have a custom server control that renders a Submit button.

The button renders just fine at design and run time.
The button click event is being trapped normally.

My problem : If I add a textbox and a required field validator, my button does not cause either the normal client or server side validation to occur.

Is there a method I must call or an interface I must implement to get my custom control wired up on the Page like a normal Button control. A normal button gets the OnClick Javascript added automatically when rendered if a validation control is no the page. In addition a normal Button control causes the Page.Validate method to run.

Thank you so much for your help,

Karl
Nov 18 '05 #1
2 4281
In your rendered HTML for the button, create an onclick attribute with the
text from the Page.GetPostBackEventReference. The only concern is that this
method may need to be called during the OnPreRender phase. Its probably too
late to call it in Render. If you are using Render to create the button's
HTML, call GetPostBackEventReference in OnPreRender and save the string in a
field until Render.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"KarlCharlotteNc" <an*******@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
I have a custom server control that renders a Submit button.

The button renders just fine at design and run time.
The button click event is being trapped normally.

My problem : If I add a textbox and a required field validator, my button does not cause either the normal client or server side validation to occur.
Is there a method I must call or an interface I must implement to get my custom control wired up on the Page like a normal Button control. A normal
button gets the OnClick Javascript added automatically when rendered if a
validation control is no the page. In addition a normal Button control
causes the Page.Validate method to run.
Thank you so much for your help,

Karl

Nov 18 '05 #2
because you are rendering the html, you have to add the javascript call
yourself.

-- bruce (sqlwork.com)
"KarlCharlotteNc" <an*******@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
I have a custom server control that renders a Submit button.

The button renders just fine at design and run time.
The button click event is being trapped normally.

My problem : If I add a textbox and a required field validator, my button does not cause either the normal client or server side validation to occur.
Is there a method I must call or an interface I must implement to get my custom control wired up on the Page like a normal Button control. A normal
button gets the OnClick Javascript added automatically when rendered if a
validation control is no the page. In addition a normal Button control
causes the Page.Validate method to run.
Thank you so much for your help,

Karl

Nov 18 '05 #3

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

Similar topics

2
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow...
9
by: Alex Shirley | last post by:
Hi there I’m simply trying to check for a blank or empty value in a textbox on my webform. In this instance I do not want to use a requiredfieldvalidator, I want to use a customvalidator (as I...
0
by: Ron | last post by:
I've an aspx page with a custom (composite) server control and a TextBox, both with RequiredFieldValidators. I'd like the custom control to behave the same way the default TextBox does when one...
2
by: Barbara Alderton | last post by:
I setup some standard Required Field Validation controls and one Custom validation control on an ASP.NET page (within a user control) to validate text entry. I also setup a Summary Control to post...
1
by: Stephen Adam | last post by:
Hi there, I have written a custom validation control which checks to see of an input field is not empty and contains only numeric data. I was using a regular expression validation control but...
2
by: dustbort | last post by:
I recently had a problem where my required field validator stopped working. But, the page still posted back and tried to insert a record into the database without performing server-side validation....
1
by: rn5a | last post by:
I have created a custom control button which when clicked displays a message in the JavaScript alert dialog. I could successfully compile the VB class file into a DLL & also could add it to the...
8
by: Radu | last post by:
Hi. I have an ASP control on my page: <asp:Calendar ID="calStart" ................ Etc </asp:Calendar> and I have a Custom Validator defined as <asp:CustomValidator
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
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: 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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
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...

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.