Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3497392
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:21:54+00:00 2026-05-18T12:21:54+00:00

I have written a web part in C# for Sharepoint 2007 which has a

  • 0

I have written a web part in C# for Sharepoint 2007 which has a single field which is validated as a required field using RequiredFieldValidator(). The web part also has some configuration fields (ones you edit by clicking on Modify Shared Web Part).

When I make changes to these fields and try to apply them, the validation of the user field kicks in and prevents the update, even though I am not submitting the form. I am only trying to submit the settings. The web part may be used in a few places on our farm, so site collection administrators need to be able to change the settings – at the moment it is not friendly enough for these users to do so.

Here is where I validate the user field:

// Validate form field - required field, and max length is 100 characters.
InputFormRequiredFieldValidator messageRequiredValidator = new InputFormRequiredFieldValidator();
messageRequiredValidator.ControlToValidate = txtMessage.ID;
messageRequiredValidator.ErrorMessage = "You must write a message to send!";
messageRequiredValidator.Display = ValidatorDisplay.Dynamic;
messageRequiredValidator.Text = "<img src=\"/_layouts/images/CNSCA16.gif\"/> You must write a message to send.";
tc.Controls.Add(messageRequiredValidator);

Here is where I define one of the configuration fields:

private string recipientEmailAddress = "sender@domain.tld";
    [WebBrowsable(true),
    Personalizable(true),
    WebPartStorage(Storage.Shared),
    WebDescription("Email address the form should be sent to"),
    WebDisplayName("Recipient Email Address"),
    SPWebCategoryName("Email Settings")]
    public string RecipientEmailAddress
    {
        get { return recipientEmailAddress; }
        set { recipientEmailAddress = value; }
    }

This is the first web part I have written, so there may be some subtleties I am missing in how to do admin configuration and validation of user submitted fields.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:21:54+00:00Added an answer on May 18, 2026 at 12:21 pm

    Ok – I’ve found the key to this. You can add a validationGroup property to each validator, and to the button that causes the validation. So I changed my code to include:

    messageRequiredValidator.validationGroup = "UserInput";
    

    and a similar property to my submit button. Now when I click on Ok in the ToolPane, it doesn’t validate the UserInput validation group. That only happens when I click on my Submit button.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application written using CherryPy, which is run locally on 127.0.0.1:4321
I have a web application, written in ColdFusion, which periodically starts using 100% of
I have written a web app in PHP which makes use of Ajax requests
I have an asp.net web page written in C#. Using some javascript I popup
I'm writing a sharepoint web part. It writes logs into a file (by using
I have a web part that uses PortalSiteMapProvider to query the Sharepoint navigation hierarchy,
I have inherited a poorly written web application that seems to have errors when
I have a web application written in C# that consumes several internal web services.
We have a customer that is trying to call our web service written in
I need a little help on this subject. I have a Web application written

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.