Place variable in title

2 posts, 0 answers
  1. Chili
    Chili avatar
    46 posts
    Member since:
    Aug 2018

    Posted 04 Dec 2018 Link to this post

    As you have read the title. I want to add a variable in my title. When I put a property in my model, and also define the model in my div. It still gives me the error:

    The name 'property' does not exist in the current. But when I add series for example I can do Model => Model.propname Why is it not possible to do this? sTotalCount is in Model2
    The code:

    @model model1
     
     
     
    <div class="demo-section k-content wide">
        @(Html.Kendo().Chart<App.Model2>()
        .Name("test" + Model1.ID)
        .Title(sTotalcount + "this is the total")


  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 07 Dec 2018 Link to this post

    Hi Chili,

    The expression in the Series is only for specifying which property should be used and it does not populate any particular value from the DataSource directly. This means that it is not possible to get particular value from the DataSource and set it as a "Title" of the Chart. You could however use a value from ViewModel ("model1").


    Regards,
    Konstantin Dikov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top