Maybe Off Topic, but I am curious...

3 posts, 0 answers
  1. Joe
    Joe avatar
    220 posts
    Member since:
    May 2012

    Posted 22 Dec 2016 Link to this post

    I have created a few HtmlHelper extension methods that we use is different projects at my company, but they've usually been single level type of method calls, with a variable list of parameters.  But how does Kendo create the HTML Helpers such as those found in the Telerik MVC collection, with nested method calls?

    For example, I've easily create a razor helper that parses a session variable for Claim data, and return the appropriate claim value based on the type.  Such as 

        ViewBag.Title = "Vensure.Dashboard.App";
        string FullName = Html.GetClaimValue("fullname");
        bool isAdmin = Html.GetClaimValue("app-roles").Contains("admin");


    But the Kendo components typically have multiple methods extending the initial method.  Such as:

            .DataSource(ds => ds.Read("GetClientList", "Mapping"))
            .Template("<span class=\"k-state-default\">#: data.ClientId # - #: data.ClientName #</span>")
            .ValueTemplate("<span class=\"selected-value\">#:data.ClientId# - #:data.ClientName#</span>")
            .HtmlAttributes(new { style = "width: 100%" })
            .Events(e => e.Change("clientChange"))
            .OptionLabel(" -- Select Client --")


    I'm just curious as to what the HtmlHelper extension code looks like to support the .Method().OtherMethod().YetAnotherMethod() nested syntax...

  2. Joe
    Joe avatar
    220 posts
    Member since:
    May 2012

    Posted 22 Dec 2016 in reply to Joe Link to this post

    Never mind.. after giving it some more thought, the answer dawned on me... it's not really as mysterious as I thought...
  3. Kiril Nikolov
    Kiril Nikolov avatar
    2596 posts

    Posted 26 Dec 2016 Link to this post


    I am happy to hear that the issue is resolved. In case you have any further questions - do no hesitate to contact us.

    Kiril Nikolov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top