Removing unnecessary attributes and elements

Thread is closed for posting
4 posts, 0 answers
  1. JT
    JT avatar
    3 posts
    Member since:
    Sep 2009

    Posted 14 Jun 2010 Link to this post

    How can I disable RadChart from rendering a style, the javascript onerror call, and the additional script block.  I want to simply show a RadChart that does not involve any further user interaction nor postbacks.

    For example, here's what my RadChart outputs:
    <div id="ctl04_BarCharts_ctrl1_BarChart" class=" RadChart" style="height:44px;width:293px;"
        <img alt='' style='border-width: 0px;'  src='ChartImage.axd?UseSession=true&amp;ChartID=530d344a-c0c1-408c-b083-88a56c512866_chart_ctl04$BarCharts$ctrl1$BarChart&amp;imageFormat=Png&amp;random=0.0234165825058783' onerror="if(confirm('Error loading RadChart image.\nYou may also wish to check the ASP.NET Trace for further details.\nDisplay stack trace?'))window.location.href=this.src;" /><input id="ctl04_BarCharts_ctrl1_BarChart_ClientState" name="ctl04_BarCharts_ctrl1_BarChart_ClientState" type="hidden" /> 
    </div><script type="text/javascript"
    //<![CDATA[ 
        Sys.Application.add_init(function(){});
    //]]> 
    </script> 
     


    and here's what I'd like it to output:
    <div id="ctl04_BarCharts_ctrl1_BarChart" class=" RadChart"
        <img alt='' src='ChartImage.axd?UseSession=true&amp;ChartID=530d344a-c0c1-408c-b083-88a56c512866_chart_ctl04$BarCharts$ctrl1$BarChart&amp;imageFormat=Png&amp;random=0.0234165825058783' /> 
    </div>

    or better yet:
        <img alt='' src='ChartImage.axd?UseSession=true&amp;ChartID=530d344a-c0c1-408c-b083-88a56c512866_chart_ctl04$BarCharts$ctrl1$BarChart&amp;imageFormat=Png&amp;random=0.0234165825058783' />  



  2. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 17 Jun 2010 Link to this post

    Hello JT,

    The onerror call is only generated in debug mode. Once you deploy your app in production it will not get generated. Also, if you disable the ClientSettings ant AutoPostBack=false you will have less markup generated.

    Kind regards,
    Vladimir Milev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. JT
    JT avatar
    3 posts
    Member since:
    Sep 2009

    Posted 17 Jun 2010 Link to this post

    Thanks for the response Vladimir.  Setting debug to false in the config did the trick for the javascript onerror.
    How can I disable ClientSettings and where is the AutoPostBack property for RadChart?
  4. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 22 Jun 2010 Link to this post

    Hi JT,

    About the ClientSettings, you simply don't need to have such a tag in your .aspx file. If you have it then make sure that ClientSettings.ScrollMode is ChartClientScrollMode.None.

    About the AutoPostBack functionality, I incidentally misled you. If you are not using any client-side scrolling and zooming (see above), and don't have any click events wired RadChart will automatically not render any javascript.

    Best wishes,
    Vladimir Milev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top