Solved

About the requiredfieldvalidator control

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 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