当前位置: 首页>>代码示例>>C#>>正文


C# UI.UserControl类代码示例

本文整理汇总了C#中System.Web.UI.UserControl的典型用法代码示例。如果您正苦于以下问题:C# UserControl类的具体用法?C# UserControl怎么用?C# UserControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UserControl类属于System.Web.UI命名空间,在下文中一共展示了UserControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterInitializationScripts

 public void RegisterInitializationScripts(UserControl control, params string[] scripts)
 {
     var key = control.GetType().BaseType.Name;
     if (_initializationLines.ContainsKey(key))
         return;
     _initializationLines.Add(key, scripts.ToSeparatedString("\r\n"));
 }
开发者ID:Psolow,项目名称:Umbraco-Public,代码行数:7,代码来源:ModuleScripts.cs

示例2: PopupAggiungiEccezione_AggiungiButtonClicked

        private void PopupAggiungiEccezione_AggiungiButtonClicked(object sender, UserControl.RagioniSocialiCorrelate.AggiungiEccezioneEventArgs e)
        {
            try
            {
                string err = proxyMtd.InsertDealerImport(e.Codice);

                if (err == "")
                {
                    DealerTable = proxyMtd.GetAllDealerImport();
                    eccImportGridView.DataSource = DealerTable;
                    eccImportGridView.DataBind();
                    importUpdatePanel.Update();

                    PopupAggiungiEccezione.Hide();
                }
                else
                {
                    PopupAggiungiEccezione.setErrorMessage("Codice esistente!");

                }
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
开发者ID:walkstudio,项目名称:Anagrafica-Dealer,代码行数:26,代码来源:ImportEccezioni.aspx.cs

示例3: PodlaczDoBazy

        public PodlaczDoBazy(UserControl l)
        {
            login = l;

            ConnStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + HttpRuntime.AppDomainAppPath + @"\App_Data\Database_Ankiety.accdb;Jet OLEDB:Database Password=";
            MyConn = new OleDbConnection(ConnStr);
        }
开发者ID:kleks,项目名称:Ankieta,代码行数:7,代码来源:PodlaczDoBazy.cs

示例4: GetPortalModuleBase

        /// <Summary>
        /// GetPortalModuleBase gets the parent PortalModuleBase Control
        /// </Summary>
        public static PortalModuleBase GetPortalModuleBase( UserControl objControl )
        {
            PortalModuleBase objPortalModuleBase = null;

            Panel ctlPanel;

            if (objControl is SkinObjectBase)
            {
                ctlPanel = (Panel)objControl.Parent.FindControl("ModuleContent");
            }
            else
            {
                ctlPanel = (Panel)objControl.FindControl("ModuleContent");
            }

            if (ctlPanel != null)
            {
                try
                {
                    objPortalModuleBase = (PortalModuleBase)ctlPanel.Controls[0];
                }
                catch
                {
                    // module was not loaded correctly
                }
            }

            if (objPortalModuleBase == null)
            {
                objPortalModuleBase = new PortalModuleBase();
                objPortalModuleBase.ModuleConfiguration = new ModuleInfo();
            }

            return objPortalModuleBase;
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:38,代码来源:Container.ascx.cs

示例5: LoadControlFromVirtualPath

 /// <summary>
 /// Load a webforms view (Page, UserControl, MasterPage) from the given virtual path.
 /// </summary>
 /// <param name="virtualPath"></param>
 /// <returns></returns>
 public static Control LoadControlFromVirtualPath(string virtualPath)
 {
     // We're using LoadControl of an arbitrary UserControl to load the view. We could also use the BuildManager, but
     // in that case, the control hierarchy appears to be empty and thus, pretty useless.
     UserControl controlLoader = new UserControl();
     return controlLoader.LoadControl(virtualPath);
 }
开发者ID:xwyangjshb,项目名称:cuyahoga,代码行数:12,代码来源:ViewUtil.cs

示例6: Properties_Deny_Unrestricted

		public void Properties_Deny_Unrestricted ()
		{
			UserControl uc = new UserControl ();
			try {
				Assert.IsNull (uc.Application, "Application");
			}
			catch (NullReferenceException) {
				// ms 2.0 rc
			}
			Assert.IsNotNull (uc.Attributes, "Attributes");
			try {
				Assert.IsNull (uc.Cache, "Cache");
			}
			catch (NullReferenceException) {
				// ms 2.0 rc
			}
			try {
				Assert.IsFalse (uc.IsPostBack, "IsPostBack");
			}
			catch (NullReferenceException) {
				// ms 2.0 rc
			}
			try {
				Assert.IsNull (uc.Request, "Request");
			}
			catch (NullReferenceException) {
				// ms 2.0 rc
			}
			try {
				Assert.IsNull (uc.Response, "Response");
			}
			catch (NullReferenceException) {
				// ms 2.0 rc
			}
			try {
				Assert.IsNull (uc.Server, "Server");
			}
			catch (NullReferenceException) {
				// ms 2.0 rc
			}
			try {
				Assert.IsNull (uc.Session, "Session");
			}
			catch (NullReferenceException) {
				// ms 2.0 rc
			}
			try {
				Assert.IsNull (uc.Trace, "Trace");
			}
			catch (NullReferenceException) {
				// ms 2.0 rc
			}
			try {
				Assert.IsNotNull (uc.CachePolicy, "CachePolicy");
			}
			catch (NotImplementedException) {
				// mono
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:59,代码来源:UserControlCas.cs

示例7: PodlaczDoBazy

        public PodlaczDoBazy(UserControl l)
        {
            login = l;

              //  ConnStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + HttpRuntime.AppDomainAppPath + @"\App_Data\Database_Ankiety.accdb;Jet OLEDB:Database Password=";

              //  ConnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=(LocalDB)\v11.0;AttachDbFilename=\"C:\\Users\\Użytkownik\\Desktop\\Ankiety v2\\Ankiety v2\\App_Data\\BazaDanychV2.mdf\";Integrated Security=True;Connect Timeout=30";

              //  MyConn = new OleDbConnection(ConnStr);
        }
开发者ID:kleks,项目名称:Ankieta,代码行数:10,代码来源:PodlaczDoBazy.cs

示例8: RegisterStartUpScript

 /// <summary>
 ///     Registers a script near the end of the form only allowed to register Js scripts.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="scriptName">Name of the script.</param>
 /// <param name="script">The script.</param>
 /// <param name="minimized">if set to <c>true</c> [minimized].</param>
 public void RegisterStartUpScript(UserControl control, string scriptName, string script, bool minimized = false)
 {
     Contract.Requires(control != null);
     if (minimized)
     {
         script = this.MinimizeJsCode(script);
     }
     control.Page.ClientScript.RegisterStartupScript(control.GetType(), scriptName,
         string.Format("<script>{0}</script>", script));
 }
开发者ID:asebak,项目名称:rapbattleonline,代码行数:17,代码来源:ClientProviders.cs

示例9: SetPropertyValues

 public static void SetPropertyValues(UserControl control, HttpContext context)
 {
     var metadata = GetMetadata(control.GetType());
     foreach (var property in metadata.Keys)
     {
         object value = GetValue(metadata[property], context) ?? GetDefaultValue(property);
         if (value != null)
         {
             property.SetValue(control, Convert.ChangeType(value, property.PropertyType), null);
         }
     }
 }
开发者ID:xxfss2,项目名称:MyLibrary,代码行数:12,代码来源:SelectPropertyMetaDataProc.cs

示例10: RenderControl

        private string RenderControl(UserControl control)
        {
            StringBuilder sb = new StringBuilder();

            // Render the control into the stringbuilder
            StringWriter sw = new StringWriter( sb );
            Html32TextWriter htw = new Html32TextWriter( sw );
            control.RenderControl( htw );

            // Get full body text
            return sb.ToString();
        }
开发者ID:coredweller,项目名称:Listened-List,代码行数:12,代码来源:EmailManager.cs

示例11: GetPlaceholderKeyName

        /// <summary>
        /// 	Gets the name of the placeholder key that the passed in sublayout is bound to.  This will return an empty string
        /// 	if for some reason we cannot get the placeholder name.
        /// 
        /// 	You would use this from the code behind of a sublayout.  So for example if I had a sublayout sltList and 
        /// 	I wanted to know what placeholder it was bound to I would have something this in the code behind 
        /// 	"string plcKeyName = PresentationUtil.GetPlaceholderKeyName(this);"
        /// </summary>
        /// <param name = "sublayout">The sublayout.</param>
        /// <returns></returns>
        public static string GetPlaceholderKeyName(UserControl sublayout)
        {
            if (sublayout == null) return string.Empty;
            if (sublayout.Parent == null) return string.Empty;
            if (sublayout.Parent.Parent == null) return string.Empty;

            //Make sure my grandparent is a placeholder, if not return an empty string
            if (typeof (Placeholder) != sublayout.Parent.Parent.GetType()) return string.Empty;

            //The placeholder is my grandparent, so cast it and get the key value
            Placeholder grandParent = (Placeholder) sublayout.Parent.Parent;
            return grandParent.Key;
        }
开发者ID:Velir,项目名称:Sitecore-Commons,代码行数:23,代码来源:PresentationUtil.cs

示例12: AddControlToBody_WithOtherControl_AddsControlToBodyControl

        public void AddControlToBody_WithOtherControl_AddsControlToBodyControl()
        {
            // arrange
            var updatePanel = new UpdatePanel();
            var control = new UserControl();
            var bodyControl = new UserControl();
            var page = new SubtextMasterPage();

            // act
            page.AddControlToBody("Other", control, updatePanel, bodyControl);

            // assert
            Assert.AreEqual(control, bodyControl.Controls[0]);
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:14,代码来源:SubtextMasterPageTests.cs

示例13: LoadControl_WithControlName_ReplacesDotWithUnderscoreInId

        public void LoadControl_WithControlName_ReplacesDotWithUnderscoreInId()
        {
            // arrange
            var containerControl = new Mock<IContainerControl>();
            var loadedControl = new UserControl {ID = "Foo.Bar"};
            containerControl.Setup(tc => tc.LoadControl("~/Skins/OfMyChinnyChinChin/Controls/ViewPost.ascx")).Returns(loadedControl);
            var skin = new SkinConfig { TemplateFolder = "OfMyChinnyChinChin" };
            var skinControlLoader = new SkinControlLoader(containerControl.Object, skin);

            // act
            var control = skinControlLoader.LoadControl("ViewPost");

            // assert
            Assert.AreEqual("Foo_Bar", control.ID);
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:15,代码来源:SkinControlLoaderTests.cs

示例14: LoadControl_WithControlName_LoadsTheControlFromTheSkinFolder

        public void LoadControl_WithControlName_LoadsTheControlFromTheSkinFolder()
        {
            // arrange
            var containerControl = new Mock<IContainerControl>();
            var loadedControl = new UserControl { ID = "Foo.Bar" };
            containerControl.Setup(tc => tc.LoadControl("~/Skins/OfMyChinnyChinChin/Controls/ViewPost.ascx")).Returns(loadedControl);
            var skin = new SkinConfig {TemplateFolder = "OfMyChinnyChinChin"};
            var skinControlLoader = new SkinControlLoader(containerControl.Object, skin);

            // act
            var control = skinControlLoader.LoadControl("ViewPost");

            // assert
            Assert.AreSame(loadedControl, control);
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:15,代码来源:SkinControlLoaderTests.cs

示例15: AddControlToBody_WithComments_AddsControlToUpdatePanel

        public void AddControlToBody_WithComments_AddsControlToUpdatePanel()
        {
            // arrange
            var updatePanel = new UpdatePanel();
            var control = new UserControl {Visible = false};
            var bodyControl = new UserControl();
            var page = new SubtextMasterPage();

            // act
            page.AddControlToBody("Comments", control, updatePanel, bodyControl);

            // assert
            Assert.AreEqual(control, updatePanel.ContentTemplateContainer.Controls[0]);
            Assert.IsTrue(control.Visible);
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:15,代码来源:SubtextMasterPageTests.cs


注:本文中的System.Web.UI.UserControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。