A panel that is made into a tab panel throgh jquery client side scripting.
Inheritance: System.Web.UI.WebControls.Panel
Beispiel #1
0
 /// <summary>Adds the tab panel to a parent container and returns it.</summary>
 /// <param name="container">The parent container onto which to add the container defined by this interface.</param>
 /// <returns>The newly added tab panel.</returns>
 public override Control AddTo(Control container)
 {
     TabPanel p = new TabPanel();
     p.ID = Name;
     p.TabText = GetLocalizedText("TabText") ?? TabText;
     p.RegisterTabCss = registerTabCss;
     p.CssClass = CssClass ?? p.CssClass;
     container.Controls.Add(p);
     return p;
 }
		/// <summary>Adds the tab panel to a parent container and returns it.</summary>
		/// <param name="container">The parent container onto which to add the container defined by this interface.</param>
		/// <returns>The newly added tab panel.</returns>
		public override Control AddTo(Control container)
		{
			TabPanel p = new TabPanel();
			p.ID = Name;
			p.TabText = GetLocalizedText("TabText") ?? TabText;
			p.RegisterTabCss = registerTabCss;
			if (string.IsNullOrEmpty(CssClass))
			{
				p.CssClass = "tabPanel primaryTabs";

				var parentTab = container.Closest(c => c is TabPanel || c is ItemEditor);
				if (parentTab != null)
				{
					p.CssClass = "tabPanel " + parentTab.ClientID + "Tabs";
				}
			}
			else
				p.CssClass = CssClass;
			container.Controls.Add(p);
			return p;
		}
 private void AddValidator(TabPanel themeTabPanel)
 {
     var validator = new CustomValidator();
     validator.Display = ValidatorDisplay.None;
     validator.ServerValidate += (s, e) =>
     {
         var control = (s as CustomValidator);
         var themeEditor = control.Parent.Controls.Cast<Control>().Where(x => x is ItemEditor).Cast<ItemEditor>().First();
         var resourcePlugins = N2.Context.Current.Resolve<IPluginFinder>()
                                 .GetPlugins<BootstrapResourceAttribute>()
                                 .Where(x => x.ResourceType == BootstrapResourceAttribute.ResourceTypeEnum.CssOrLess)
                                 .ToList();
         themeEditor.UpdateObject(new CommandContext(themeEditor.Definition,
                     themeEditor.CurrentItem,
                     "theme-editor",
                     N2.Context.Current.RequestContext.User));
         var variables = Less.ThemedLessEngine.GetThemeVariables(themeEditor.CurrentItem as Models.BootstrapThemeConfiguration);
         foreach (var resource in resourcePlugins)
         {
             var themedLocation = Less.ThemedLessEngine.GetThemedFile(Path.Combine(Url.ResolveTokens("{ThemesUrl}/Default/"), resource.Name), themeEditor.ID);
             try
             {
                 Less.ThemedLessEngine.CompileLess(themedLocation, null, themeEditor.ID, variables);
             }
             catch (Exception ex)
             {
                 control.ErrorMessage = "Error with theme \"" + themeEditor.ID + "\":    " + ex.Message;
                 e.IsValid = false;
                 return;
             }
         }
         e.IsValid = true;
     };
     themeTabPanel.Controls.Add(validator);
 }