Custom HtmlHelper

2 posts, 0 answers
  1. Denis
    Denis avatar
    1 posts
    Member since:
    Jan 2017

    Posted 26 Jul 2018 Link to this post

    Hello everybody!

    I would like to make my helper. In UI for MVC It looked like this

    public static WindowBuilder KendoWindow(this HtmlHelper helper, string name, string titleResKey, string dataRequestUrl = null, int? minWidth = null, int? minHeight = null, int? maxWidth = null, int? maxHeight = null, string onRefreshEvent = null)
            {
                var attrib = new Dictionary<string, object>();

                var window = helper.Kendo()
                .Window()
                .Name(name)
                .Title(titleResKey)
                .Draggable()
                .Actions(action => action.Close())
                .Animation(true)
                .Events(x => x.Activate("onKendoWindowActivate").Close("onKendoWindowClose"))
                .Modal(true)
                .Visible(false).AutoFocus(true);

    return window;

    }

    But in the version for Net Core I do not have a reference helper.Kendo()

    How can I do this now? Thank you

     

     

  2. Dimitar
    Admin
    Dimitar avatar
    812 posts

    Posted 31 Jul 2018 Link to this post

    Hello Denis,

    Try using the WindowBuilder as follows:
    using Kendo.Mvc.UI.Fluent;
     
    namespace TelerikAspNetCoreAppWindow
    {
        public static class CustomHtmlHelperExtensions
        {
            public static WindowBuilder MyKendoWindow(this WindowBuilder helper, string name, string titleResKey,
                string dataRequestUrl = null, int? minWidth = null, int? minHeight = null, int? maxWidth = null,
                int? maxHeight = null, string onRefreshEvent = null)      
            {
                return helper
                    .Name(name)
                    .Title(titleResKey)
                    .Draggable()
                    .Actions(action => action.Close())
                    .Animation(true)
                    .Events(x => x.Activate("onKendoWindowActivate").Close("onKendoWindowClose"))
                    .Modal(true)
                    .Visible(false).AutoFocus(true);
            }
        }
    }

    Regards,
    Dimitar
    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