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

The following code is adding extra %22 after the aspx which cause link to fail.

XmlElement p = new XmlDocument().CreateElement("p");
p.InnerText = @"<table style=""width: 100%""><tbody>
                                <tr><td>&#160;<a href=" + web.Url + @"/Lists/Jr/AllItems.aspx"">J & R</a></td></tr>
                                <tr><td>&#160;<a href=" + web.Url + @"/SalesStatus/Forms/AllItems.aspx"">Sales Status</a></td></tr> </tbody></table>";
                ContentEditorWebPart cewp = new ContentEditorWebPart
                    Content = p
share|improve this question
up vote 2 down vote accepted

%22 is code for quote (").

This is because you forgot to add a starting quote. I mean, if, for example, web.Url is equal to http://localhost, final html will be:

<a href=http://localhost/Lists/Jr/AllItems.aspx">J & R</a>

This html is not correct, so sharepoint "fixes" it, replacing " with %20.

You should provide starting quote as well as the ending one, as follows:

p.InnerText = @"<table style=""width: 100%""><tbody>
                <tr><td>&#160;<a href=""" + web.Url + @"/Lists/Jr/AllItems.aspx"">J & R</a></td></tr>
                <tr><td>&#160;<a href=""" + web.Url + @"/SalesStatus/Forms/AllItems.aspx"">Sales Status</a></td></tr> </tbody></table>";
share|improve this answer
You are a SPHero.... Thanks for your help... Monica – Monica Contera May 21 '11 at 13:09

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.