Solved

About the requiredfieldvalidator control

Posted on 2008-06-16
4
457 Views
Last Modified: 2012-06-27
Hi, I have a txt box and a button in a webpart/server control.  I also have a requiredfieldvalidator control.  When I click the button I want to call the requiredfieldvalidators.validate() function.  However, before I do this I need to set the controltovalidate property to the controlid of the textbox.  This is not working.  I have tried setting the id property of the textbox to "textbox" and then setting the controltovalidate property to textbox.ID.  When I do this and call validate() an exception is thrown stating that the reference is not set to an instance of an object.  I think I am passing in the wrong id to the controltovalidate property.
Can you help?
0
Comment
Question by:millerthegorilla
  • 2
  • 2
4 Comments
 
LVL 22

Expert Comment

by:prairiedog
ID: 21794171
Did you set the controltovalidate property  in the designer or in the code behind? Are you using VS 2005?
0
 

Author Comment

by:millerthegorilla
ID: 21794699
I set the controlvalidate property in the code behind.  I don't have access to the designer as I'm designing sharepoint web parts.  At least I don't think I do.  I'm a bit new to this.  I'm using VS2008.
I set the requiredfieldvalidator validator = new requiredfieldvalidator in the createchildcontrols() method.  I set the ID of the text box to a string eg theTextBox.ID = "thetextbox" and the textbox is set to a new instance in createchildcontrols() and yet I'm still getting the object not set to an instance exception.
0
 
LVL 22

Accepted Solution

by:
prairiedog earned 500 total points
ID: 21794774
Well, I am no expert in SharePoint development. I got this question because it is labeled in ASP.NET zone. You may need to add SharePoint zone in your question so experts in that zone will be able to see this question and give you solution.
0
 

Author Closing Comment

by:millerthegorilla
ID: 31467499
thanks - I'll resubmit the question in the sharepoint zone.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now