本文整理汇总了C#中System.Web.UI.UserControl.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# UserControl.GetType方法的具体用法?C# UserControl.GetType怎么用?C# UserControl.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.UserControl
的用法示例。
在下文中一共展示了UserControl.GetType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"));
}
示例2: 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));
}
示例3: OnInit
protected override void OnInit(EventArgs e)
{
base.OnInit (e);
Control oControl = new System.Web.UI.UserControl().LoadControl(_usercontrolPath);
if (HasSettings(oControl.GetType()))
{
DataEditorSettingsStorage ss = new DataEditorSettingsStorage();
List<Setting<string, string>> s = ss.GetSettings(((umbraco.cms.businesslogic.datatype.DefaultData)_data).DataTypeDefinitionId);
ss.Dispose();
foreach (Setting<string, string> setting in s)
{
try
{
if(!string.IsNullOrEmpty(setting.Key))
{
oControl.GetType().InvokeMember(setting.Key, System.Reflection.BindingFlags.SetProperty, null, oControl, new object[] { setting.Value });
}
}
catch (MissingMethodException) { }
}
}
// Add property data to the usercontrol if it supports it
// TODO: Find the best way to test for an interface!
IUsercontrolPropertyData propertyData = oControl as IUsercontrolPropertyData;
if (propertyData != null)
{
propertyData.PropertyObject = new Property(((usercontrolData)_data).PropertyId);
}
this.Controls.Add(oControl);
if (!Page.IsPostBack)
((IUsercontrolDataEditor)Controls[0] as IUsercontrolDataEditor).value = _data.Value;
}
示例4: 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);
}
}
}
示例5: Hide
/// <summary>
/// Hides the specified u.
/// </summary>
/// <param name="u">The u.</param>
public static void Hide(UserControl u)
{
u.Page.ClientScript.RegisterClientScriptBlock(u.GetType(), "busyindicatorhide",
"sap.ui.core.BusyIndicator.hide();", true);
}
示例6: InitializeUserControl
private void InitializeUserControl(UserControl instance)
{
if (!this.alreadyInitializedControls.Contains(instance))
{
// ASP.NET creates a sub type for UserControls with all the mark up, but this is not the
// type that a user can register and not always a type that can be initialized.
Type type = instance.GetType().BaseType;
this.InitializeInstance(type, instance);
// Ensure every user control is only initialized once.
this.alreadyInitializedControls.Add(instance);
}
}
示例7: RegisterClientScriptBlock
/// <summary>
/// Registers a Js Script at the header of a page. Can use minimization and external files based on parameters passed
/// to function.
/// </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>
/// <param name="isExternalFile">if set to <c>true</c> [is external file].</param>
public void RegisterClientScriptBlock(UserControl control, string scriptName, string script,
bool minimized = false, bool isExternalFile = false)
{
Contract.Requires(control != null);
if (minimized)
{
script = this.MinimizeJsCode(script);
}
if (isExternalFile)
{
//TODO: verifiy map path
script = File.ReadAllText(this.RapContext.MapPath(script));
}
control.Page.ClientScript.RegisterClientScriptBlock(control.GetType(), scriptName,
string.Format("<script>{0}</script>", script));
}
示例8: RegisterRawScript
/// <summary>
/// Registers a raw external css or js file. This should be used if the file is already minimized
/// </summary>
/// <param name="control">The control.</param>
/// <param name="scriptName">Name of the script.</param>
/// <param name="rawScript">The raw script.</param>
public void RegisterRawScript(UserControl control, string scriptName, string rawScript)
{
Contract.Requires(control != null);
control.Page.ClientScript.RegisterClientScriptBlock(control.GetType(), scriptName,
string.Format("{0}", rawScript));
}
示例9: DisplayRealTimeSuccess
/// <summary>
/// Displays the real time success.
/// </summary>
/// <param name="control">The control.</param>
/// <param name="content">The content.</param>
public void DisplayRealTimeSuccess(UserControl control, string content)
{
control.Page.ClientScript.RegisterStartupScript(control.GetType(), "alertifySuccess",
"alertify.success('{0}')".FormatWith(content), true);
}
示例10: DisplayRealTimeError
/// <summary>
/// Displays the real time error.
/// </summary>
/// <param name="control">The control.</param>
/// <param name="content">The content.</param>
public void DisplayRealTimeError(UserControl control, string content)
{
control.Page.ClientScript.RegisterStartupScript(control.GetType(), "alertifyError",
"alertify.error('"+ content + "')", true);
}
示例11: DisplayRealTimeNotification
/// <summary>
/// Displays the real time notification.
/// </summary>
/// <param name="control">The control.</param>
/// <param name="content">The content.</param>
public void DisplayRealTimeNotification(UserControl control, string content)
{
control.Page.ClientScript.RegisterStartupScript(control.GetType(), "alertifyNotification",
"alertify.log('{0}')".FormatWith(content), true);
}