?
Solved

About the requiredfieldvalidator control

Posted on 2008-06-16
4
Medium Priority
?
463 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

718 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