示例#1
0
        public static void RenderOptionsProperties(IHtmlWriter writer, SelectorBase selector)
        {
            writer.AddKnockoutDataBind("options", selector, ItemsControl.DataSourceProperty, renderEvenInServerRenderingMode: true);
            if (selector.ItemTextBinding != null)
            {
                writer.AddKnockoutDataBind("optionsText", selector.ItemTextBinding.GetProperty <SelectorItemBindingProperty>().Expression, selector);
            }
            #pragma warning disable
            else if (!String.IsNullOrEmpty(selector.DisplayMember))
            {
                writer.AddKnockoutDataBind("optionsText", "function (i) { return ko.unwrap(i)[" + KnockoutHelper.MakeStringLiteral(selector.DisplayMember) + "]; }");
            }
            #pragma warning restore

            if (selector.ItemValueBinding != null)
            {
                writer.AddKnockoutDataBind("optionsValue", selector.ItemValueBinding.GetProperty <SelectorItemBindingProperty>().Expression, selector);
            }
            #pragma warning disable
            else if (!String.IsNullOrEmpty(selector.ValueMember))
            {
                writer.AddKnockoutDataBind("optionsValue", "function (i) { return ko.unwrap(i)[" + KnockoutHelper.MakeStringLiteral(selector.ValueMember) + "]; }");
            }
            #pragma warning restore
        }
 public static void RenderChangedEvent(IHtmlWriter writer, SelectorBase selector)
 {
     var selectionChangedBinding = selector.GetCommandBinding(SelectorBase.SelectionChangedProperty);
     if (selectionChangedBinding != null)
     {
         writer.AddAttribute("onchange", KnockoutHelper.GenerateClientPostBackScript(nameof(SelectorBase.SelectionChanged), selectionChangedBinding, selector, isOnChange: true, useWindowSetTimeout: true));
     }
 }
        public static void RenderChangedEvent(IHtmlWriter writer, SelectorBase selector)
        {
            var selectionChangedBinding = selector.GetCommandBinding(SelectorBase.SelectionChangedProperty);

            if (selectionChangedBinding != null)
            {
                writer.AddAttribute("onchange", KnockoutHelper.GenerateClientPostBackScript(nameof(SelectorBase.SelectionChanged), selectionChangedBinding, selector, isOnChange: true, useWindowSetTimeout: true), true, ";");
            }
        }
 public static void RenderEnabledProperty(IHtmlWriter writer, SelectorBase selector)
 {
     writer.AddKnockoutDataBind("enable", selector, SelectorBase.EnabledProperty, () =>
     {
         if (!selector.Enabled)
         {
             writer.AddAttribute("disabled", "disabled");
         }
     });
 }
 public static void RenderEnabledProperty(IHtmlWriter writer, SelectorBase selector)
 {
     writer.AddKnockoutDataBind("enable", selector, SelectorBase.EnabledProperty, () =>
     {
         if (!selector.Enabled)
         {
             writer.AddAttribute("disabled", "disabled");
         }
     });
 }
 public static void RenderOptionsProperties(IHtmlWriter writer, SelectorBase selector)
 {
     writer.AddKnockoutDataBind("options", selector, ItemsControl.DataSourceProperty, renderEvenInServerRenderingMode: true);
     if (!String.IsNullOrEmpty(selector.DisplayMember))
     {
         writer.AddKnockoutDataBind("optionsText", "function (i) { return ko.unwrap(i)[" + KnockoutHelper.MakeStringLiteral(selector.DisplayMember) + "]; }");
     }
     if (!String.IsNullOrEmpty(selector.ValueMember))
     {
         writer.AddKnockoutDataBind("optionsValue", "function (i) { return ko.unwrap(i)[" + KnockoutHelper.MakeStringLiteral(selector.ValueMember) + "]; }");
     }
 }
示例#7
0
 public static void RenderOptionsProperties(IHtmlWriter writer, SelectorBase selector)
 {
     writer.AddKnockoutDataBind("options", selector, ItemsControl.DataSourceProperty, renderEvenInServerRenderingMode: true);
     if (!String.IsNullOrEmpty(selector.DisplayMember))
     {
         writer.AddKnockoutDataBind("optionsText", "function (i) { return ko.unwrap(i)[" + KnockoutHelper.MakeStringLiteral(selector.DisplayMember) + "]; }");
     }
     if (!String.IsNullOrEmpty(selector.ValueMember))
     {
         writer.AddKnockoutDataBind("optionsValue", "function (i) { return ko.unwrap(i)[" + KnockoutHelper.MakeStringLiteral(selector.ValueMember) + "]; }");
     }
 }
        public static void RenderOptionsProperties(IHtmlWriter writer, SelectorBase selector)
        {
            writer.AddKnockoutDataBind("options", selector, ItemsControl.DataSourceProperty, renderEvenInServerRenderingMode: true);
            if (selector.ItemTextBinding != null)
            {
                writer.AddKnockoutDataBind("optionsText", selector.ItemTextBinding.GetProperty <SelectorItemBindingProperty>().Expression, selector);
            }

            if (selector.ItemValueBinding != null)
            {
                writer.AddKnockoutDataBind("optionsValue", selector.ItemValueBinding.GetProperty <SelectorItemBindingProperty>().Expression, selector);
            }

            if (selector.ItemTitleBinding != null)
            {
                writer.AddKnockoutDataBind("optionsTitle", selector.ItemTitleBinding.GetProperty <SelectorItemBindingProperty>().Expression, selector);
            }
        }