More in this section
Forums / Developing with Sitefinity / Using ' in news title causes error with NewsView

Using ' in news title causes error with NewsView

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
4 posts, 0 answered
  1. UI Crew
    UI Crew avatar
    151 posts
    27 Sep 2012
    05 Feb 2009
    Link to this post

    If a content manager uses an apostrophy in the new title it causes and error when displaying the detail news article using the News View.

    "20 Must-Do's when in Queensland"

    Basically the url is being created without replacing the ' for a _

    Is there any solution - can we get the url rewritter to replace ' with a _


  2. Georgi
    Georgi avatar
    3583 posts
    28 Oct 2016
    05 Feb 2009
    Link to this post
    Hello Seth Cleaver,

    I am not able to reproduce the problem, please check the attached screenshot.  My UrlRewriteFormat for the News provider is set to urlRewriteFormat="[Title].aspx", and the UrlWhiteSpaceChar - urlWhitespaceChar="_".

    Do you any other values for these properties? Alternatively, you can add a new meta field, in which you will enter the URL Title, and then use this metafield in your UrlRewriteFormat.

    Sincerely yours,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Emil
    Emil avatar
    6 posts
    25 Feb 2009
    03 Aug 2009
    Link to this post
    I have a very similar problem. My News Titles have double quotes. Eg:  Iam Testing "News".  or "Testing" title

    the url removes the double quotes and then querystring["title"] doesnt match with the title metafield. 

    The solution you mentioned, having another metafield called URL and them changing urlRewriteFormat="[URL]".aspx seems nice but I have close to 500 News Items and It might take too long to touch all these items and add the URL fields. Is there another approach to fix this issue?

  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    01 Feb 2016
    04 Aug 2009
    Link to this post
    Hello Emil,

    Thank you for using our serves.

    What you can do in your case, to avoid manually updating all news items, is to create a custom class. On the page load event of that custom class, you will take all news items using the NewManager class and update their content. Here is a sample code how to do this:
    protected void Page_Load(object sender, EventArgs e) 
        Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager("News");   
        IList news = contentManager.GetContent(); 
        foreach (Telerik.Cms.Engine.IContent newsItem in news)   
            //assign the value of the URL metafield to the url variable 
            string url= newsItem.GetMetaData("URL").ToString(); 
            //add logic to update url 
            Telerik.Cms.Engine.IContent updateItem = contentManager.GetContent(newsItem.ID); 
            //update URL metafield to the vaule of url variable 
            updateItem.SetMetaData("URL", url); 

    You can find more information on how to modify content items here:
    Modifying Content Items
    Event Module: URL Rewriting

    I hope you will find the provided information helpful. Feel free to contact us if you have more questions.

    All the best,
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
Register for webinar
4 posts, 0 answered