本文整理匯總了C#中System.Web.UI.Control類的典型用法代碼示例。如果您正苦於以下問題:C# Control類的具體用法?C# Control怎麽用?C# Control使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Control類屬於System.Web.UI命名空間,在下文中一共展示了Control類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FindjQuery
public static jquerybasic FindjQuery(Control control)
{
jquerybasic jquerybasic1 = null;
if (control is Page) {
Page thePage = (Page)control;
foreach (Control c in thePage.Header.Controls) {
if (c is jquerybasic) {
jquerybasic1 = (jquerybasic)c;
break;
} else {
jquerybasic1 = FindjQuery(c);
if (jquerybasic1 != null) {
break;
}
}
}
} else {
foreach (Control c in control.Controls) {
if (c is jquerybasic) {
jquerybasic1 = (jquerybasic)c;
break;
} else {
jquerybasic1 = FindjQuery(c);
if (jquerybasic1 != null) {
break;
}
}
}
}
return jquerybasic1;
}
示例2: GridViewTemplate
public GridViewTemplate(DataControlRowType type, string colNameFr, string colNameDt, Control con)
{
templateType = type;
columnNameFriendly = colNameFr;
columnNameData = colNameDt;
control = con;
}
示例3: BuildFromDirectory
private static void BuildFromDirectory(string baseDir, Control level)
{
foreach (string idxDir in Directory.GetDirectories(baseDir))
{
string dir = idxDir.Replace(baseDir, "");
// Skipping .svn and similar directories...
if (dir.IndexOf(".") == 0)
{
continue;
}
TreeNode n = new TreeNode {ID = level.ID + dir, Xtra = idxDir, Text = dir};
level.Controls.Add(n);
string[] childDirectories = Directory.GetDirectories(idxDir);
if (childDirectories.Length > 0)
{
// Skipping .svn and similar directories...
if (childDirectories.Length == 1)
{
string tmpDir = childDirectories[0];
tmpDir = tmpDir.Substring(tmpDir.LastIndexOf("\\") + 1);
if (tmpDir.IndexOf(".") == 0)
{
continue;
}
}
TreeNodes children = new TreeNodes {ID = "ch" + n.ID};
n.Controls.Add(children);
BuildFromDirectory(idxDir + "\\", children);
}
}
}
示例4: AddTo
public override Control AddTo(Control container, PluginContext context)
{
var requiredPermission = context.Selected.State == ContentState.Published ? Permission.Publish : Permission.Write;
if (!context.Engine.SecurityManager.IsAuthorized(context.HttpContext.User, context.Selected, requiredPermission))
return null;
if(!ActiveFor(container, context.State)) return null;
if (!context.Selected.VersionOf.HasValue)
return base.AddTo(container, context);
HyperLink hl = new HyperLink();
hl.Text = GetInnerHtml(context, "{IconsUrl}/cross_orange.png", ToolTip, Title);
hl.NavigateUrl = Url.Parse("{ManagementUrl}/Content/DiscardPreview.aspx").ResolveTokens()
.AppendQuery("selectedUrl", context.Selected.Url)
.AppendQuery(PathData.ItemQueryKey, context.Selected.VersionOf.ID)
.AppendQuery(PathData.VersionIndexQueryKey, context.Selected.VersionIndex);
hl.CssClass = "cancel";
hl.Attributes["onclick"] = "return confirm('Are you certain?');";
hl.ToolTip = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? context.Format("Delete this version", false);
container.Controls.Add(hl);
return hl;
}
示例5: CreateMailMessage
public MailMessage CreateMailMessage(string recipients, IDictionary replacements, Control owner)
{
if (owner == null)
{
throw new ArgumentNullException("owner");
}
string body = string.Empty;
string bodyFileName = this.BodyFileName;
if (!string.IsNullOrEmpty(bodyFileName))
{
string path = bodyFileName;
if (!UrlPath.IsAbsolutePhysicalPath(path))
{
path = UrlPath.Combine(owner.AppRelativeTemplateSourceDirectory, path);
}
TextReader reader = new StreamReader(owner.OpenFile(path));
try
{
body = reader.ReadToEnd();
}
finally
{
reader.Close();
}
}
return this.CreateMailMessage(recipients, replacements, body, owner);
}
示例6: AddTo
public override Control AddTo(Control container, PluginContext context)
{
HtmlGenericControl hgc = new HtmlGenericControl("div");
hgc.Attributes["class"] = "separator";
container.Controls.Add(hgc);
return hgc;
}
示例7: GetEditValue
/// <summary>
/// Reads new values entered by the user for the field
/// </summary>
/// <param name="control">Parent control that controls were added to in the CreateEditControl() method</param>
/// <param name="configurationValues"></param>
/// <returns></returns>
public override string GetEditValue( Control control, Dictionary<string, ConfigurationValue> configurationValues )
{
if ( control != null && control is ListControl )
return ( (ListControl)control ).SelectedValue;
return null;
}
示例8: addProperty
public void addProperty(string Caption, Control C) {
/*
tr = new TableRow();
td = new TableCell();
td.Text = Caption;
td.Attributes.Add("width", "15%");
td.Attributes.Add("valign", "top");
td.Attributes.Add("class", "propertyHeader");
tr.Cells.Add(td);
td = new TableCell();
td.Attributes.Add("class", "propertyContent");
td.Controls.Add(C);
tr.Cells.Add(td);
tbl.Rows.Add(tr);
if (!this.Controls.Contains(tbl)) {
this.Controls.Add(tbl);
}*/
PropertyPanel pp = new PropertyPanel();
pp.Controls.Add(C);
pp.Text = Caption;
this.Controls.Add(pp);
}
示例9: AddTo
public override Control AddTo(ContentItem item, string detailName, Control container)
{
Control displayer = (Control)Activator.CreateInstance(ControlType);
Utility.SetProperty(displayer, ControlPropertyName, item[detailName]);
container.Controls.Add(displayer);
return displayer;
}
示例10: TranslateControlText
private static void TranslateControlText(Control control)
{
IEnumerable<IControlTranslator> translators = GetControlTranslators(control);
foreach (IControlTranslator translator in translators)
translator.Translate();
}
示例11: RegisteredExpandoAttribute
internal RegisteredExpandoAttribute (Control control, string controlId, string name, string value, bool encode) {
_control = control;
_name = name;
_value = value;
_controlId = controlId;
_encode = encode;
}
示例12: GetWebValidateBox
private Control GetWebValidateBox(Control ct)
{
if (ct is WebValidate)
{
return ct;
}
else if (ct.HasControls())
{
foreach (Control ctchild in ct.Controls)
{
if (ctchild is WebValidate)
{
return ctchild;
}
else
{
GetWebValidateBox(ctchild);
}
}
return null;
}
else
{
return null;
}
}
示例13: AddEditor
protected override Control AddEditor(Control container)
{
TimeRange range = new TimeRange {ID = Name + NameEndRange, StartTitle = StartTitle, StartRequired = StartRequired};
container.Controls.Add(range);
range.BetweenText = BetweenText;
return range;
}
示例14: GetModulePanel
void GetModulePanel(string Panel, string lang)
{
ModulesFrontPanelBSO _module = new ModulesFrontPanelBSO();
DataTable tb = _module.GetModulesFrontPanelbyPanel(Panel, lang);
string _path = ResolveUrl("~/") + "Client/Modules/MainHome/";
Control objControl = new Control();
if (tb.Rows.Count > 0)
{
for (int i = 0; i < tb.Rows.Count; i++)
{
//if (tb.Rows[i]["ModulesFrontPanel_Panel"].Equals("Left") || tb.Rows[i]["ModulesFrontPanel_Panel"].Equals("Right"))
// _path += "Client/Modules/Panel/";
//else
// if (tb.Rows[i]["ModulesFrontPanel_Panel"].Equals("Main"))
// _path += "Client/Modules/MainHome/";
objControl = (Control)this.LoadControl(_path + tb.Rows[i]["ModulesFrontPanel_Url"].ToString());
AreaMainPanel.Controls.Add(objControl);
ControlParameter(objControl, tb.Rows[i]["ModulesFrontPanel_Title"].ToString(), tb.Rows[i]["ModulesFrontPanel_Icon"].ToString(), tb.Rows[i]["ModulesFrontPanel_Value"].ToString(), Convert.ToInt32(tb.Rows[i]["ModulesFrontPanel_Record"].ToString()));
}
}
}
示例15: AddLabel
protected override Label AddLabel(Control container)
{
if (string.IsNullOrEmpty(Title))
return null;
return base.AddLabel(container);
}