Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • saif 68 posts 88 karma points
    Feb 07, 2012 @ 15:48
    saif
    0

    Render Control on .cshtml page

    Hi All,

    I created a razor script RealTimePieChart.cshtml which simply bind data with chart and when I render 

     this on another .cshtml page.
    <div>
       @RenderPage("~/macroScripts/RealTimePieChart.cshtml") 
    </div> 

    It displays the chart all over the page please could you tell me how to display it only in a fixed portion of the page or bottom of the page.

    kind regards

    saif

  • Ben Norman 167 posts 276 karma points
    Feb 08, 2012 @ 01:10
    Ben Norman
    0

    Its is probably related to your css and html and not umbraco.

    If you post the url to your page then you might catch someone able to help.

  • saif 68 posts 88 karma points
    Feb 08, 2012 @ 11:18
    saif
    0

    I am afraid at the moment our site is not accessible over the internet.

    Here is the original form, all input data has been grouped in sec1,sec2 ,... and, sec9 and they reflect on the chart below

    Scenario is I have to create a chart which reflects how many sections have been completed.

    I tried to display the chart using renderpage  as a helper.

    @RenderPage("~/macroScripts/RealTimePieChart.cshtml")

    Please see image below. I want to display it at the end of sections but everything disappears except the chart.

     

    I also tried img tag.

    <p> <img src="~/macroScripts/RealTimePieChart.cshtml" alt="" /></p>

     

     

    any help would be really appreciated

     

     

     

     

  • hetaurhet 245 posts 267 karma points
    Feb 14, 2012 @ 10:46
    hetaurhet
    0

    It is actually related to class u apply or check template once in which you use this razor macro.

  • saif 68 posts 88 karma points
    Feb 14, 2012 @ 12:26
    saif
    0

    Thank you hetaurhet for quick reply. If I am not wrong do you mean by class is "layout.cshtml" or "Helper.cshtml" or somthing else - -please could you explain this a little further.
    Do you think the .write() method may be causing any problems in displaying the chart in a particular area of the page?

     var machart = new Chart(width: 400, height: 300, theme: ChartTheme.Green)
                        .AddTitle("Whole school review")
                       .SetXAxis("Blue bars show how many sections need to be filled in by each school", 0, 10)
                       .SetYAxis("How much each section has been completed in percent", 0, 100)
                       .AddSeries(
                            chartType: "Column",
                            markerStep: 2,
                            xValue: dataView,
                            xField: "Sec",
                            yValues: dataView,
                            yFields: "Per"
                        )
                    .Write();

  • hetaurhet 245 posts 267 karma points
    Feb 14, 2012 @ 12:57
    hetaurhet
    0

    No. I think above code is just defining display of chart but not its position. Where exactly this razor macro is called? R you sure you have not specified any class inside the div below?

    <div>
       @RenderPage("~/macroScripts/RealTimePieChart.cshtml") 
    </div>

     

  • saif 68 posts 88 karma points
    Feb 14, 2012 @ 15:16
    saif
    0

      Here is the main page's code

     

    DOCTYPEhtml><html><headid="Head1"runat="server">head><body>

    <form action=""method="post">

    <divid="Q_Sec_9"style="text-align: justify; color:Blue; width:80%">

    <h3>9. Assessing, recording and reporting the achievement of children and young people h3><br/>

    9.1 - How does your school assess and report on the progress and achievement of children and young people in subjects relevant to their health and wellbeing?

    <br/><textareaname="txt_A9p1_Sec_9"cols="100"rows="4">@wsrobj.A9p1_Sec_9textarea><br/><br/>

    9.2 - How does your school celebrate the achievements of children and young people across all areas of school life?

    <br/><textareaname="txt_A9p2_Sec_9"cols="100"rows="4">@wsrobj.A9p2_Sec_9textarea><br/><br/>

    <div>@RenderPage("~/macroScripts/RealTimePieChart.cshtml.cshtml");

    >

    <p><inputtype="submit"value="Submit"/>p>

    >html>

     And here is the chart code I want to render on main page

    bool isLoggedOn = HttpContext.Current.User.Identity.IsAuthenticated;

    if(isLoggedOn){

    var dfe = mdobj.GetCurrentMember().schoolName;

    theDoc = wsrobj.Get_RealTimePieChart_Pivot(dfe);

    var dataView = newDataView

    (theDoc.DT);

    var machart = newChart(width: 400, height: 300, theme: ChartTheme.Green)

    .AddTitle("Whole school review")

    .SetXAxis("Blue bars show how many sections need to be filled in by each school", 0, 10)

    .SetYAxis("How much each section has been completed in percent", 0, 100)

    .AddSeries(chartType:"Column",markerStep: 2,xValue: dataView,xField: "Sec",yValues: dataView,yFields: "Per")

    .Write();

    }

     

     

     

     

  • Douglas Ludlow 210 posts 366 karma points
    Feb 14, 2012 @ 16:20
    Douglas Ludlow
    0

    @saif, I'm assuming the main page's markup is in a masterpage template? If so then you will need to wrap your razor call to RenderPage with <umbraco:Macro> tags, like this:

    <div>
            <umbraco:Macro runat="server" language="cshtml">
                    @RenderPage("~/macroScripts/RealTimePieChart.cshtml")
            </umbraco:Macro>
    </div>

    Otherwise, razor won't know to parse it. But if this is what you're doing, why don't you make it a macro and then just call it the standard way?

  • Douglas Ludlow 210 posts 366 karma points
    Feb 14, 2012 @ 16:39
    Douglas Ludlow
    0

    Oh, just realized I misunderstood. So you are calling this from another razor script then. Okay, then I'd agree with the others who have commented on this. It sounds like a style issue. You may want to use firebug or some other tool to inspect the elements and ensure the correct css classes are being applied to the chart.

  • saif 68 posts 88 karma points
    Feb 15, 2012 @ 11:46
    saif
    0

    Hi Douglas,

    I checked the view source in IE and FF. FF does not render the chart at all and in IE chart replaces other controls and view soruce is disabled. As you suggested I tried css but this does not effect chart position at all because in the same div i used other controls and they are displayed as css style had been written.

    Any help would be really appreciated.

     

Please Sign in or register to post replies

Write your reply to:

Draft