Client Template Special Character Issue

Thread is closed for posting
4 posts, 0 answers
  1. ahmet
    ahmet avatar
    12 posts
    Member since:
    May 2014

    Posted 12 Sep 2014 Link to this post

    Hello,
    I want to use Client Template in RadHtmlChart but my data's column name has a special character.
    My sample is here (in rune time in c#),
    TooltipsAppearance.ClientTemplate = "#=dataItem."+variableX+"#";
    VariableX value is "T-001" or "T - 001".

    How can i define it?
  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1494 posts

    Posted 16 Sep 2014 Link to this post

    Hi Ahmet,


    Special characters in field names, passed to the chart, are escaped by surrounding the name with quotes and brackets
    . For example:
    ASPX:
    <telerik:RadHtmlChart ID="RadHtmlChart1" runat="server" Width="600px" Height="400px">
    </telerik:RadHtmlChart>
    C#:
    public string variableX = "T-001";
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("id");
        dt.Columns.Add(variableX);
        dt.Columns.Add("yValues");
     
        for (int i = 0; i < 5; i++)
        {
            dt.Rows.Add(i, (10 + i).ToString() + " Category", 5 + i);
        }
     
        LineSeries sls1 = new LineSeries();
        sls1.TooltipsAppearance.ClientTemplate = "#=dataItem[\\'T-001\\']#";
        sls1.LabelsAppearance.DataFormatString = "{0:d}";
        RadHtmlChart1.PlotArea.XAxis.DataLabelsField = "[\\'" + variableX + "\\']";
        sls1.DataFieldY = "yValues";
     
        RadHtmlChart1.PlotArea.Series.Add(sls1);
        RadHtmlChart1.DataSource = dt;
        RadHtmlChart1.DataBind();
    }

    You may also find useful this forum post.

    Regards,
    Danail Vasilev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ahmet
    ahmet avatar
    12 posts
    Member since:
    May 2014

    Posted 16 Sep 2014 in reply to Danail Vasilev Link to this post

    Thanks for your help, it works but i want to use like that
    TooltipsAppearance.ClientTemplate = "#=dataItem[\\'" + YAxisColumn + "\\']# - Tarih #= kendo.format(\"{0:yyyy-MM-dd HH:mm}\",dataItem.CREATE_DATE) #";
                LabelsAppearance.DataFormatString = "{0:d}";
    This time, don't allow the use of the second data.
    Please help once again.
  5. ahmet
    ahmet avatar
    12 posts
    Member since:
    May 2014

    Posted 16 Sep 2014 Link to this post

    Ok, my fault. Thank u so musch..
Back to Top