Solved

About the requiredfieldvalidator control

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

14 Experts available now in Live!

Get 1:1 Help Now