예제 #1
0
        public static TabStripBuilder VnrTabStrip(this HtmlHelper helper, TabStripBuilderInfo builderInfo)
        {
            var tabsFactory = new Action<TabStripItemFactory>(tab =>
            {
                foreach (var tabItem in builderInfo.TabItems)
                {
                    if (!string.IsNullOrEmpty(tabItem.Value.Controller) && !string.IsNullOrEmpty(tabItem.Value.Action))
                    {
                        if (tabItem.Value.Parameter!=null)
                        {
                            tab.Add()
                            .Text(tabItem.Key)
                            .LoadContentFrom(tabItem.Value.Action, tabItem.Value.Controller,tabItem.Value.Parameter)
                            .Selected(tabItem.Value.Selected);
                        }
                        else
                        {
                            tab.Add()
                            .Text(tabItem.Key)
                            .LoadContentFrom(tabItem.Value.Action, tabItem.Value.Controller)
                            .Selected(tabItem.Value.Selected);
                        }
                    }
                    else
                    {
                        tab.Add()
                        .Text(tabItem.Key)
                        .Content(tabItem.Value.Content)
                        .Selected(tabItem.Value.Selected);
                    }
                }
            });

            var eventTabs = new Action<TabStripEventBuilder>(e =>
            {
                if (!string.IsNullOrWhiteSpace(builderInfo.EActivate))
                {
                    e.Activate(builderInfo.EActivate);
                } 
                
                if (!string.IsNullOrWhiteSpace(builderInfo.ESelect))
                {
                    e.Select(builderInfo.ESelect);
                } 
                
                if (!string.IsNullOrWhiteSpace(builderInfo.EError))
                {
                    e.Error(builderInfo.EError);
                }
                if (!string.IsNullOrWhiteSpace(builderInfo.EContentLoad))
                {
                    e.ContentLoad(builderInfo.EContentLoad);
                }

            });

            var tabStripBuilder = helper.Kendo()
                .TabStrip()
                .Items(tabsFactory)
                .Events(eventTabs);
            if (!string.IsNullOrWhiteSpace(builderInfo.Name))
            {
                tabStripBuilder.Name(builderInfo.Name);
            }
            return tabStripBuilder;
        }
예제 #2
0
        public static TabStripBuilder VnrTabStrip(this HtmlHelper helper, TabStripBuilderInfo builderInfo)
        {
            var tabsFactory = new Action <TabStripItemFactory>(tab =>
            {
                foreach (var tabItem in builderInfo.TabItems)
                {
                    if (!string.IsNullOrEmpty(tabItem.Value.Controller) && !string.IsNullOrEmpty(tabItem.Value.Action))
                    {
                        if (tabItem.Value.Parameter != null)
                        {
                            tab.Add()
                            .Text(tabItem.Key)
                            .LoadContentFrom(tabItem.Value.Action, tabItem.Value.Controller, tabItem.Value.Parameter)
                            .Selected(tabItem.Value.Selected);
                        }
                        else
                        {
                            tab.Add()
                            .Text(tabItem.Key)
                            .LoadContentFrom(tabItem.Value.Action, tabItem.Value.Controller)
                            .Selected(tabItem.Value.Selected);
                        }
                    }
                    else
                    {
                        tab.Add()
                        .Text(tabItem.Key)
                        .Content(tabItem.Value.Content)
                        .Selected(tabItem.Value.Selected);
                    }
                }
            });

            var eventTabs = new Action <TabStripEventBuilder>(e =>
            {
                if (!string.IsNullOrWhiteSpace(builderInfo.EActivate))
                {
                    e.Activate(builderInfo.EActivate);
                }

                if (!string.IsNullOrWhiteSpace(builderInfo.ESelect))
                {
                    e.Select(builderInfo.ESelect);
                }

                if (!string.IsNullOrWhiteSpace(builderInfo.EError))
                {
                    e.Error(builderInfo.EError);
                }
                if (!string.IsNullOrWhiteSpace(builderInfo.EContentLoad))
                {
                    e.ContentLoad(builderInfo.EContentLoad);
                }
            });

            var tabStripBuilder = helper.Kendo()
                                  .TabStrip()
                                  .Items(tabsFactory)
                                  .Events(eventTabs);

            if (!string.IsNullOrWhiteSpace(builderInfo.Name))
            {
                tabStripBuilder.Name(builderInfo.Name);
            }
            return(tabStripBuilder);
        }