SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom user control which is a "subscribe form". The user enters name, email etc and selects values from dropdowns I data bind from lists. I can view the page no problem and use the form but if I try to edit a page with the user control and then publish it I get the "This page contains content that is not valid. You can find more information in the affected sections."


   private void DataBindDropdowns()
                string siteUrl = SPContext.Current.Site.Url;
                using (SPSite oSiteCollection = new SPSite(siteUrl))
                    using (SPWeb oWebsite = oSiteCollection.OpenWeb())
                        //Bind the Title (Mr/Mrs/..) dropdown
                        SPList titleList = oWebsite.Lists[Constants.ListNames.SubscribeFormTitles];
                        if (titleList != null)
                            List<ListItem> source = new List<ListItem>();
                            source.Add(new ListItem("Please select", "Please select"));
                                .Select(pa => new ListItem(pa.Title, pa.Title))
                                .OrderBy(pa => pa.Text));
                            ddlTitles.DataSource = source;

                        SPList interestList = oWebsite.Lists[Constants.ListNames.SubscribeFormInterest];
                        if (interestList != null)
                            var collListItems = from i in interestList.Items.Cast<SPListItem>()
                                                where i[SPBuiltInFieldId.Title] != null
                                                orderby i[SPBuiltInFieldId.Title]
                                                select i;
                            chkInterest.DataSource = collListItems;

                        SPList formTextList = oWebsite.Lists[Constants.ListNames.SubscribeFormText];
                        if (formTextList != null)
                            var collListItems = formTextList.Items.Cast<SPListItem>();
                            ltTop.Text = collListItems.First()[Constants.FieldNames.TopText].ToString();
                            ltBottom.Text = collListItems.First()[Constants.FieldNames.BottomText].ToString();
                            SubscribeFormTitle.InnerText = collListItems.First().Title.ToString();

Is there anything obvious in the code that can cause this problem?

Thanks in advance.

share|improve this question
up vote 0 down vote accepted

You might be using validation controls for name, email etc .If so, Use Validation group so that validation happens only on the button click of user control.

share|improve this answer
I already figured out the problem and you're correct. I also don't need to display the user control in edit mode so I put it in an editmodepanel with attribute PageDisplayMode="Display" – John Dec 2 '11 at 3:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.