RequiredFieldValidator control |
lukezha posted on Thursday, February 01, 2007 10:28 PM
|
------=_NextPart_0001_2C95AC73
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hello Vinni,
When you said it didn't validate the page, do you mean the error message
didn't display? And it only display its initial value "Zero"? And, how
didn't you submit the form, by clicking a button on same web part?
If the problem is that that error message doesn't displayed, I suggest you
may check the HTML source code on the client side, is the validate control
rendered correctly on the client side, and is the TextBox' ID string same
as the value you set to the validate control in web part?
Sincerely,
Luke Zhang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
------=_NextPart_0001_2C95AC73
Content-Type: text/x-rtf
Content-Transfer-Encoding: 7bit
{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\lang2052\f0\fs20 Hello Vinni,
\par
\par When you said it didn't validate the page, do you mean the error message didn't display? And it only display its initial value "Zero"? And, how didn't you submit the form, by clicking a button on same web part?
\par
\par If the problem is that that error message doesn't displayed, I suggest you may check the HTML source code on the client side, is the validate control rendered correctly on the client side, and is the TextBox' ID string same as the value you set to the validate control in web part?
\par
\par Sincerely,
\par
\par Luke Zhang
\par
\par Microsoft Online Community Support
\par ==================================================
\par Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notifications.
\par
\par Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx.
\par ==================================================
\par
\par This posting is provided "AS IS" with no warranties, and confers no rights.
\par
\par
\par
\par }
------=_NextPart_0001_2C95AC73-- |
 |
|
Thank you for your response. I actually figured out the mistake I was doing. |
Vinn posted on Friday, February 02, 2007 7:11 AM
|
Thank you for your response. I actually figured out the mistake I was doing.
I had ErrorMessage property set but not the Text property. When I add another
line as fieldVal.Text = "Test Error Text Message"; then it validate and
showed the error message as "Test Error Text Message". I believe if you do
not have Text property set then it will not work. (I know this works fine in
normal asp.net pages but here it is SharePoint Web Parts)
fieldVal = new RequiredFieldValidator();
fieldVal.ID = txtemail.ID + "_Val";
fieldVal.ControlToValidate = txtemail.ID;
fieldVal.EnableClientScript = true;
fieldVal.ErrorMessage = " Test";
fieldVal.Text = "Test Error Text Message";
fieldVal.InitialValue = "Zero";
fieldVal.Display =
System.Web.UI.WebControls.ValidatorDisplay.Dynamic;
//fieldVal.SetFocusOnError = txtemail;
Controls.Add(fieldVal);
I hope this information will help others.
Thanks again.
--
Vinni | www.Laksha.net |
 |
|