本文整理汇总了C#中System.Web.UI.WebControls.WebControl类的典型用法代码示例。如果您正苦于以下问题:C# WebControl类的具体用法?C# WebControl怎么用?C# WebControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebControl类属于System.Web.UI.WebControls命名空间,在下文中一共展示了WebControl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetUpEmployeesView
public static void SetUpEmployeesView(WebControl control, string title)
{
ASPxNavBar navBar = (ASPxNavBar)control;
NavBarGroup employeesGroup = navBar.Groups.First();
employeesGroup.Items.Clear();
employeesGroup.Text = title;
}
开发者ID:gvallejo,项目名称:ShiftScheduler,代码行数:7,代码来源:UIHelper.cs
示例2: AutoFillExtender
public AutoFillExtender(AutoFillExtenderXml xml, WebControl target)
{
_targetControl = target;
_type = xml.Type;
_filterId = xml.FilterId;
this.Name = xml.Name;
}
开发者ID:danilocecilia,项目名称:HulcherProject,代码行数:7,代码来源:AutoFillExtender.cs
示例3: StyleControl
private static void StyleControl(WebControl control)
{
if (control == null || control is TableCell || control is LinkButton) return;
if (control is Label) control.CssClass.Toggle("ErrorLabel", "{0} {1}");
else control.CssClass.Toggle("ErrorItem", "{0} {1}");
}
开发者ID:NLADP,项目名称:ADF,代码行数:7,代码来源:SmartPanelErrorStyler.cs
示例4: AddAttributesToRender
public sealed override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
{
string cssClass = string.Empty;
bool flag = true;
if (this._owner.IsSet(2))
{
cssClass = this._owner.CssClass;
}
if (base.RegisteredCssClass.Length != 0)
{
flag = false;
if (cssClass.Length != 0)
{
cssClass = cssClass + " " + base.RegisteredCssClass;
}
else
{
cssClass = base.RegisteredCssClass;
}
}
if (cssClass.Length > 0)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);
}
if (flag)
{
base.GetStyleAttributes(owner).Render(writer);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:HyperLinkStyle.cs
示例5: makeCell
public static WebControl makeCell(Directory directory)
{
WebControl td = new WebControl(HtmlTextWriterTag.Td);
//td.BorderWidth = Unit.Pixel(1);
td.Style.Add(HtmlTextWriterStyle.Padding, "1em");
td.Style.Add(HtmlTextWriterStyle.VerticalAlign, "top");
td.CssClass += "vcard";
Panel textPanel = new Panel();
textPanel.Style.Add("float", "left");
Panel namePanel = new Panel();
namePanel.CssClass += "n ";
namePanel.CssClass += "fn ";
namePanel.Controls.Add(makeLastName(directory));
namePanel.Controls.Add(makeFirstNames(directory));
textPanel.Controls.Add(namePanel);
textPanel.Controls.Add(makeAddress(directory));
textPanel.Controls.Add(makeGeneralEmails(directory));
textPanel.Controls.Add(makePersonEmails(directory));
textPanel.Controls.Add(makeGeneralPhones(directory));
textPanel.Controls.Add(makePersonPhones(directory));
td.Controls.Add(textPanel);
if (directory.photo != null && directory.photo.Id != null && directory.photo.PicasaEntry != null)
{
Panel picturePanel = new Panel();
picturePanel.Style.Add("float", "right");
picturePanel.Controls.Add(makeGeneralPhoto(directory));
td.Controls.Add(picturePanel);
}
return td;
}
开发者ID:Letractively,项目名称:rpcwc,代码行数:32,代码来源:DirectoryHelper.cs
示例6: AddAttributesToRender
public override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner)
{
base.AddAttributesToRender(writer, owner);
if (!this.Wrap)
{
if (this.IsControlEnableLegacyRendering(owner))
{
writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, "nowrap");
}
else
{
writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
}
}
System.Web.UI.WebControls.HorizontalAlign horizontalAlign = this.HorizontalAlign;
if (horizontalAlign != System.Web.UI.WebControls.HorizontalAlign.NotSet)
{
TypeConverter converter = TypeDescriptor.GetConverter(typeof(System.Web.UI.WebControls.HorizontalAlign));
writer.AddAttribute(HtmlTextWriterAttribute.Align, converter.ConvertToString(horizontalAlign).ToLower(CultureInfo.InvariantCulture));
}
System.Web.UI.WebControls.VerticalAlign verticalAlign = this.VerticalAlign;
if (verticalAlign != System.Web.UI.WebControls.VerticalAlign.NotSet)
{
TypeConverter converter2 = TypeDescriptor.GetConverter(typeof(System.Web.UI.WebControls.VerticalAlign));
writer.AddAttribute(HtmlTextWriterAttribute.Valign, converter2.ConvertToString(verticalAlign).ToLower(CultureInfo.InvariantCulture));
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:TableItemStyle.cs
示例7: addStyleSheet
public static void addStyleSheet(string css, string key, Page currentPage, WebControl control)
{
ControlCollection ctrls = currentPage.Controls;
if (currentPage.Master != null)
ctrls = currentPage.Master.Controls;
foreach (Control ctrl in ctrls)
{
if (ctrl.GetType().Name == "HtmlHead")
{
ctrls = ctrl.Controls;
break;
}
}
if (key != null)
{
foreach (Control ctrl in ctrls)
{
if (ctrl.ID == key)
return;
}
}
string url = currentPage.ClientScript.GetWebResourceUrl(control.GetType(), "ESWCtrls.ResEmbed.Styles." + css);
HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("media", "screen");
link.Href = url;
link.ID = key;
ctrls.Add(new LiteralControl("\n"));
ctrls.Add(link);
}
开发者ID:Leonscape,项目名称:ESWCtrls,代码行数:35,代码来源:Util.cs
示例8: TryEnable
bool TryEnable(WebControl c, bool enabled)
{
if (c == null || c is Button)
return false;
c.Enabled = enabled;
return true;
}
开发者ID:gbahns,项目名称:Tennis,代码行数:7,代码来源:BaseControl.cs
示例9: SetSelector
/// <summary>
/// 設置Selector
/// </summary>
/// <param name="ctrlTrigger">控件ID--按鈕</param>
/// <param name="ctrlCode">控件ID--文本框1</param>
/// <param name="ctrlName">控件ID--文本框2</param>
public void SetSelector(WebControl ctrlTrigger, Control ctrlCode, Control ctrlName)
{
if (ctrlCode is TextBox) { (ctrlCode as TextBox).Attributes.Add("readonly", "readonly"); }
if (ctrlName is TextBox) { (ctrlName as TextBox).Attributes.Add("readonly", "readonly"); }
ctrlTrigger.Attributes.Add("onclick", string.Format("return setSelector('{0}','{1}','{2}')",
ctrlCode.ClientID, ctrlName.ClientID, Request.QueryString["modulecode"]));
}
开发者ID:chanhan,项目名称:Project,代码行数:13,代码来源:WorkFlowSet.aspx.cs
示例10: RenderRepeater
// What is baseControl for ?
public void RenderRepeater (HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
{
PrintValues (user);
RepeatLayout layout = RepeatLayout;
bool listLayout = layout == RepeatLayout.OrderedList || layout == RepeatLayout.UnorderedList;
if (listLayout) {
if (user != null) {
if ((user.HasHeader || user.HasFooter || user.HasSeparators))
throw new InvalidOperationException ("The UnorderedList and OrderedList layouts do not support headers, footers or separators.");
}
if (OuterTableImplied)
throw new InvalidOperationException ("The UnorderedList and OrderedList layouts do not support implied outer tables.");
int cols = RepeatColumns;
if (cols > 1)
throw new InvalidOperationException ("The UnorderedList and OrderedList layouts do not support multi-column layouts.");
}
if (RepeatDirection == RepeatDirection.Vertical) {
if (listLayout)
RenderList (w, user, controlStyle, baseControl);
else
RenderVert (w, user, controlStyle, baseControl);
} else {
if (listLayout)
throw new InvalidOperationException ("The UnorderedList and OrderedList layouts only support vertical layout.");
RenderHoriz (w, user, controlStyle, baseControl);
}
}
开发者ID:Profit0004,项目名称:mono,代码行数:31,代码来源:RepeatInfo.cs
示例11: Save
//protected static string ReadCss()
//{
// string res;
// string fileName = string.Format("table.css");
// string path = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Themes\Default\" + fileName);
// using (StreamReader s = new StreamReader(path))
// {
// res = s.ReadToEnd();
// }
// return res;
//}
public static bool Save(WebControl grid, string path)
{
try
{
using (StreamWriter s = new StreamWriter(path, false, Encoding.Unicode))
{
Page page = new Page();
page.EnableViewState = false;
HtmlForm frm = new HtmlForm();
frm.Attributes["runat"] = "server";
page.Controls.Add(frm);
frm.Controls.Add(grid);
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
frm.RenderControl(htmlWrite);
string start = @"<style>.text { mso-number-format:\@; }</style>";
s.Write(start);
s.Write(stringWrite.ToString());
}
return true;
}
catch
{
throw;
}
}
开发者ID:thaond,项目名称:vdms-sym-project,代码行数:38,代码来源:GridView2Excel.cs
示例12: SetSelector
/// <summary>
/// 設置Selector
/// </summary>
/// <param name="ctrlTrigger">控件ID--按鈕</param>
/// <param name="ctrlCode">控件ID--文本框1</param>
/// <param name="ctrlName">控件ID--文本框2</param>
/// <param name="flag">Selector區分標誌</param>
public void SetSelector(WebControl ctrlTrigger, Control ctrlCode, Control ctrlName, string flag, string moduleCode)
{
if (ctrlCode is TextBox) { (ctrlCode as TextBox).Attributes.Add("readonly", "readonly"); }
if (ctrlName is TextBox) { (ctrlName as TextBox).Attributes.Add("readonly", "readonly"); }
ctrlTrigger.Attributes.Add("onclick", string.Format("return setSelector('{0}','{1}','{2}','{3}')",
ctrlCode.ClientID, ctrlName.ClientID, flag, moduleCode));
}
开发者ID:chanhan,项目名称:Project,代码行数:14,代码来源:OTMRealQryForm.aspx.cs
示例13: AppendCssClass
/// <summary>
/// Appends a CSS class to a control.
/// </summary>
/// <param name="control">The control.</param>
/// <param name="newClass">The new class.</param>
public static void AppendCssClass(WebControl control, string newClass)
{
if (control == null)
throw new ArgumentNullException("control", "Cannot add a css class to a null control");
if (newClass == null)
throw new ArgumentNullException("newClass", "Cannot add a null css class to a control");
string existingClasses = control.CssClass;
if (String.IsNullOrEmpty(existingClasses))
{
control.CssClass = newClass;
return;
}
string[] classes = existingClasses.Split(' ');
foreach (string attributeValue in classes)
{
if (String.Equals(attributeValue, newClass, StringComparison.Ordinal))
{
//value's already in there.
return;
}
}
control.CssClass += " " + newClass;
}
开发者ID:ayende,项目名称:Subtext,代码行数:31,代码来源:HtmlHelper.cs
示例14: BuildContentsControl
private static WebControl BuildContentsControl(BlogEntry entry)
{
Panel contentsControl = new Panel();
WebControl textControl = new WebControl(HtmlTextWriterTag.P);
textControl.Controls.Add(new LiteralControl(entry.Content));
contentsControl.Controls.Add(textControl);
if (entry.Enclosure != null && entry.Enclosure.Uri != null)
{
HtmlGenericControl audio = new HtmlGenericControl("audio");
audio.Attributes.Add("controls", "controls");
audio.Attributes.Add("src", entry.Enclosure.Uri);
audio.Attributes.Add("type", "audio/mp3");
WebControl musicPlayer = new WebControl(HtmlTextWriterTag.Embed);
musicPlayer.ID = "musicPlayer_" + entry.id;
musicPlayer.Style.Add(HtmlTextWriterStyle.Width, "400px");
musicPlayer.Style.Add(HtmlTextWriterStyle.Height, "27px");
musicPlayer.Style.Add("border", "1px solid rgb(170, 170, 170)");
musicPlayer.Attributes.Add("src", "http://www.google.com/reader/ui/3523697345-audio-player.swf");
musicPlayer.Attributes.Add("flashvars", "audioUrl=" + entry.Enclosure.Uri);
musicPlayer.Attributes.Add("pluginspage", "http://www.macromedia.com/go/getflashplayer");
audio.Controls.Add(musicPlayer);
contentsControl.Controls.Add(audio);
}
return contentsControl;
}
开发者ID:Letractively,项目名称:rpcwc,代码行数:30,代码来源:BlogHelper.cs
示例15: AddAttributesToRender
public sealed override void AddAttributesToRender(HtmlTextWriter writer, WebControl owner) {
string cssClass = String.Empty;
bool renderInlineStyle = true;
if (_owner.IsSet(PROP_CSSCLASS)) {
cssClass = _owner.CssClass;
}
if (RegisteredCssClass.Length != 0) {
renderInlineStyle = false;
if (cssClass.Length != 0) {
cssClass = cssClass + " " + RegisteredCssClass;
}
else {
cssClass = RegisteredCssClass;
}
}
if (cssClass.Length > 0) {
writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);
}
if (renderInlineStyle) {
CssStyleCollection styleAttributes = GetStyleAttributes(owner);
styleAttributes.Render(writer);
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:HyperLinkStyle.cs
示例16: buildBlogPostControl
/// <summary>
/// Builds a web control for a blog post
/// </summary>
/// <param name="entry">Blog post to be built into a web control</param>
/// <returns>A web control presentation of the given blog post</returns>
public static Control buildBlogPostControl(BlogEntry entry)
{
Control blogPostControl = new Control();
if (entry == null)
return blogPostControl;
WebControl titleContentsSeparator = new WebControl(HtmlTextWriterTag.Br);
titleContentsSeparator.Attributes.Add("clear", "all");
WebControl contentsFootSeparator = new WebControl(HtmlTextWriterTag.Br);
contentsFootSeparator.Attributes.Add("clear", "all");
if (entry.Scheduled)
blogPostControl.Controls.Add(BuildScheduledBlogPostTitle(entry));
else
{
blogPostControl.Controls.Add(BuildTitleControl(entry));
blogPostControl.Controls.Add(titleContentsSeparator);
blogPostControl.Controls.Add(BuildContentsControl(entry));
blogPostControl.Controls.Add(contentsFootSeparator);
blogPostControl.Controls.Add(PostFootControl(entry));
}
//blogPostControl.Controls.Add(BuildCategoryPanel(entry));
return blogPostControl;
}
开发者ID:Letractively,项目名称:rpcwc,代码行数:31,代码来源:BlogHelper.cs
示例17: RemoveDirty
public static void RemoveDirty(WebControl control)
{
if (control != null)
{
control.CssClass = "";
}
}
开发者ID:neppie,项目名称:mixerp,代码行数:7,代码来源:FormHelper.cs
示例18: VisibleExtender
public VisibleExtender(bool _visible, WebControl _caller, WebControl _targetControl, string _targetValue)
{
visible = _visible;
callerControl = _caller;
targetControl = _targetControl;
targetValue = _targetValue;
}
开发者ID:danilocecilia,项目名称:HulcherProject,代码行数:7,代码来源:VisibleExtender.cs
示例19: SetError
/// <summary>
/// Sets the error CssClass if an error is present.
/// </summary>
/// <param name="validator"></param>
/// <param name="control"></param>
/// <param name="className"></param>
internal static void SetError(BaseValidator validator, WebControl control, string className)
{
if (validator.IsValid == false)
{
AddCssClass(control, className);
}
}
开发者ID:axle-h,项目名称:.NET-Device-Detection,代码行数:13,代码来源:Redirect.cs
示例20: SetUpClickableControl
internal void SetUpClickableControl( WebControl clickableControl )
{
if( resource == null && postBack == null && script == "" )
return;
clickableControl.CssClass = clickableControl.CssClass.ConcatenateWithSpace( "ewfClickable" );
if( resource != null && EwfPage.Instance.IsAutoDataUpdater ) {
postBack = EwfLink.GetLinkPostBack( resource );
resource = null;
}
Func<string> scriptGetter;
if( resource != null )
scriptGetter = () => "location.href = '" + EwfPage.Instance.GetClientUrl( resource.GetUrl() ) + "'; return false";
else if( postBack != null ) {
EwfPage.Instance.AddPostBack( postBack );
scriptGetter = () => PostBackButton.GetPostBackScript( postBack );
}
else
scriptGetter = () => script;
// Defer script generation until after all controls have IDs.
EwfPage.Instance.PreRender += delegate { clickableControl.AddJavaScriptEventScript( JsWritingMethods.onclick, scriptGetter() ); };
}
开发者ID:william-gross,项目名称:enterprise-web-library,代码行数:25,代码来源:ClickScript.cs
注:本文中的System.Web.UI.WebControls.WebControl类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论