RadWindow - Render html verbatim in title

3 posts, 0 answers
  1. jf820
    jf820 avatar
    12 posts
    Member since:
    Jul 2007

    Posted 25 May 2012 Link to this post

    I'm finally biting the bullet and converting over from the old asp.net controls to asp.net for ajax, and one thing is vexing me.

    In the old world, we took advantage of the fact that the title on a radwindow was rendered out verbatim to stick spans and the like into the Title on an as-needed basis from c# code for styling (ie, stylesheets will not work) and in a couple of cases, an onclick javascript function... something like:
    if (someCondition)
      Title = "<span style='color:red'>" + blah + "</span>";
    else if (someOtherCondition)
      Title = "<span style='color:green' onclick='doSomething();'>" + blah + "</span>";
    else
      Title = blah;

    In asp.net for ajax, though, it looks like the title is now being rendered after a run through Server.HtmlEncode.

    Researching shows that maybe it's related to PITS entry 2541 and this thread : http://www.telerik.com/community/forums/aspnet-ajax/window/html-element-is-rendered-in-page-title.aspx

    Am I looking at having to use set_title() in javascript to deal with this, or is there a property I can set on the Window/WindowManager declaration to make the window take the page's title verbatim, without running it through Server.HtmlEncode?
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5819 posts

    Posted 29 May 2012 Link to this post

    Hello,

    Indeed, this behavior was changed and now you can set an HTML string through the client-side set_title() method and there isn't a property to revert to the old behavior. It was changed not only because of requests, but also because it used to expose a css vulnerability.


    Regards,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. jf820
    jf820 avatar
    12 posts
    Member since:
    Jul 2007

    Posted 29 May 2012 Link to this post

    I was afraid you'd say that... Not a big deal to do, I was just hoping there'd be a property to set and I could call it done.

    Thanks for getting back to me.
Back to Top