Solved

About the requiredfieldvalidator control

Posted on 2008-06-16
4
459 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 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