Hi all,
I've created an User control. It's an extension of a textbox wich has
some extra properties so that validation becomes a lot faster.
The control wordks great if autopostback is on. When there's a value
in the textbox, the (overridden) textchanged event fires and
validation is performed.
Now I want to turn off autopostback. So I want my contol only validate
if the submit button is pressed. I've tried Page.Validate(), but It
seems only to trigger Validators. My control doesn't have to have
validators, but just raises an error.
So, I think the question is: how do I trigger the overridden
textchanged event of my custom control, preferably without writing
code in de click event of the submit-button?
Greetz,
Owin
Amsterdam 4 15666
"owingruters" <ow*********@hotmail-dot-com.no-spam.invalid> wrote in message
news:40********@Usenet.com... Hi all,
I've created an User control. It's an extension of a textbox wich has some extra properties so that validation becomes a lot faster.
The control wordks great if autopostback is on. When there's a value in the textbox, the (overridden) textchanged event fires and validation is performed.
Now I want to turn off autopostback. So I want my contol only validate if the submit button is pressed. I've tried Page.Validate(), but It seems only to trigger Validators. My control doesn't have to have validators, but just raises an error.
So, I think the question is: how do I trigger the overridden textchanged event of my custom control, preferably without writing code in de click event of the submit-button?
Owin, perhaps you'd do better to use the validation framework. I hope the
following will help:
ASP.NET Validation in Depth
( http://msdn.microsoft.com/library/de...-us/dnaspp/htm
l/aspplusvalid.asp).
--
John Saunders
johnwsaundersiii at hotmail
The text changed event should fire if the text in the box is different on
post back whether that post back was triggered by an auto post back or by
the submit button.
To make certain the control is valid use: If Page.IsValid Then
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"owingruters" <ow*********@hotmail-dot-com.no-spam.invalid> wrote in message
news:40********@Usenet.com... Hi all,
I've created an User control. It's an extension of a textbox wich has some extra properties so that validation becomes a lot faster.
The control wordks great if autopostback is on. When there's a value in the textbox, the (overridden) textchanged event fires and validation is performed.
Now I want to turn off autopostback. So I want my contol only validate if the submit button is pressed. I've tried Page.Validate(), but It seems only to trigger Validators. My control doesn't have to have validators, but just raises an error.
So, I think the question is: how do I trigger the overridden textchanged event of my custom control, preferably without writing code in de click event of the submit-button?
Greetz, Owin Amsterdam
Thank you both.
The article did not contain a solution, but it made some things clear
about the sequence in which events are handled.
And S. Justin...You were right. The event does fire. But there is one
difference: When my usercontrols Non_Validating event fires and
valdation failes, I turn the IsValid property of a CustomValidator to
false, to prevent the page from Validating.
With the autopostback property on, this is the only event that fires,
so the cuctomvalidator and the page are invalid.
When I turn the autopostback off and use a submit button to submit the
page, the bottum_click event also fires and as I found out does a
Page.Validate().
If I turn the IsValid property to false in the Non_validating event,
the Page.IsValid property also changes to falsen. Then the
Page.Validate() method is executes, and the Page.IsValid property is
set to true again.
The only way I can solve this seemes to me to make a private variable
to remember if the control valided or not and set the
customvalidator.Isvald property again in the button_click event.
This works, but I don't want the users of my custum control to have to
know all these things.
Have u got any ideas of how to solve this?
My only idea left is to not make a custom textbox, but a custom
customvalidator :) that performs the validation that I want.
Thanx for any help,
Owin
Owen,
I think you've thought this out well. A "custom" custom validator is
probably the best way to go.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"owingruters" <ow*********@hotmail-dot-com.no-spam.invalid> wrote in message
news:40********@Usenet.com... Thank you both.
The article did not contain a solution, but it made some things clear about the sequence in which events are handled.
And S. Justin...You were right. The event does fire. But there is one difference: When my usercontrols Non_Validating event fires and valdation failes, I turn the IsValid property of a CustomValidator to false, to prevent the page from Validating.
With the autopostback property on, this is the only event that fires, so the cuctomvalidator and the page are invalid. When I turn the autopostback off and use a submit button to submit the page, the bottum_click event also fires and as I found out does a Page.Validate(). If I turn the IsValid property to false in the Non_validating event, the Page.IsValid property also changes to falsen. Then the Page.Validate() method is executes, and the Page.IsValid property is set to true again.
The only way I can solve this seemes to me to make a private variable to remember if the control valided or not and set the customvalidator.Isvald property again in the button_click event.
This works, but I don't want the users of my custum control to have to know all these things.
Have u got any ideas of how to solve this? My only idea left is to not make a custom textbox, but a custom customvalidator :) that performs the validation that I want.
Thanx for any help, Owin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alphonse Giambrone |
last post by:
I have a web form with 2 user controls on it (UC1 and UC2).
Each control has a bound datagrid with textboxes in the footer to add a new
row. There are also requiredfieldvalidators in each footer....
|
by: John |
last post by:
Hi all,
This really is quite an urgent matter.
I have a page with multiple, dynamically-loaded user controls and when a
user clicks on a button, the whole form is submitted. Now at this stage...
|
by: Bijoy Naick |
last post by:
I've written a simple file upload user control in VB .NET. It comprises of
an InputFile HTML Server Control, an Upload button and a message label.
User clicks on the Browse button of the...
|
by: wolf |
last post by:
There are three webcontrol on my asp.net form: a TextBox, a submit button
and a RegularExpressionValidator. And I had set ControlToValidate property
of the RegularExpressionValidator to the...
|
by: Michael |
last post by:
I have setup a public variable in the Master Page "code-behind-file". Now I
would like to set that value from the UserControl, but I can't seem to find a
way to do this. Does anyone have any ideas?...
|
by: Smokey Grindle |
last post by:
to start off with the page the free text box (version 3) is on has
validateRequest="false" in the page directive already...
but even with that when I am in the page and then click on a link to...
|
by: rn5a |
last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with
the IDs 'txt1' & 'txt2' respectively. To use this user control in an
ASPX page, the following Register directive will be...
|
by: kelvin |
last post by:
Hi,
A difficult question.
I have a form that I used to submit to https://www. paypal.com/cgi-bin/
webscr
<form action="https://www. paypal.com/cgi-bin/webscr" method="post">
Now I need to...
|
by: thj |
last post by:
Hi.
I've got this form that I'm trying to validate:
<form id="periodForm" action="" method="post">
<p>
Periode:
<input id="startDate" name="startDate" type="text" size="7"
value="<%=...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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...
| |