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


C# this.AddAttribute方法代码示例

本文整理汇总了C#中this.AddAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# this.AddAttribute方法的具体用法?C# this.AddAttribute怎么用?C# this.AddAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在this的用法示例。


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

示例1: AddTestHistory

 public static HtmlTextWriter AddTestHistory(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string id = "")
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id);
     writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px");
     writer.RenderBeginTag(HtmlTextWriterTag.Div);
     writer.AddAttribute(HtmlTextWriterAttribute.Id, Output.GetHistoryChartId(nunitGoTest.Guid, nunitGoTest.DateTimeFinish));
     writer.RenderBeginTag(HtmlTextWriterTag.Div);
     writer.RenderEndTag();//DIV
     writer.RenderEndTag();//DIV
     return writer;
 }
开发者ID:elv1s42,项目名称:NUnitGo,代码行数:11,代码来源:TestHistorySection.cs

示例2: AddEnvironment

 public static HtmlTextWriter AddEnvironment(this HtmlTextWriter writer, string id = "")
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id);
     writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px");
     writer.RenderBeginTag(HtmlTextWriterTag.Div);
     writer.AddTag(HtmlTextWriterTag.B, "Environment information: ");
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "CLR version: " + Environment.Version);
     writer.RenderEndTag();
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "OS version: " + Environment.OSVersion.VersionString);
     writer.RenderEndTag();
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "Platform: " + Environment.OSVersion.Platform);
     writer.RenderEndTag();
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "Machine name: " + Environment.MachineName);
     writer.RenderEndTag();
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "User domain: " + Environment.UserDomainName);
     writer.RenderEndTag();
     writer.RenderBeginTag(HtmlTextWriterTag.P);
     writer.Write(Bullet.HtmlCode + "User: " + Environment.UserName);
     writer.RenderEndTag();
     writer.RenderEndTag();//DIV
     return writer;
 }
开发者ID:elv1s42,项目名称:NUnitGo,代码行数:27,代码来源:EnvironmentSection.cs

示例3: AddTestEvents

        public static HtmlTextWriter AddTestEvents(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string id = "")
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id);
            writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            var events = nunitGoTest.Events.OrderBy(x => x.Started);
            foreach (var testEvent in events)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.AddTag(HtmlTextWriterTag.B, "Test event: ");
                writer.Write(testEvent.Name);
                writer.RenderEndTag(); //P

                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write(Bullet.HtmlCode + "Started: " + testEvent.Started.ToString("dd.MM.yy HH:mm:ss.fff"));
                writer.RenderEndTag();
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write(Bullet.HtmlCode + "Finished: " + testEvent.Finished.ToString("dd.MM.yy HH:mm:ss.fff"));
                writer.RenderEndTag();
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write(Bullet.HtmlCode + "Duration: " + testEvent.DurationString);
                writer.RenderEndTag();

            }
            if (!events.Any())
                writer.Write("There are no test events in this test");
            writer.RenderEndTag();//DIV
            return writer;
        }
开发者ID:elv1s42,项目名称:NUnitGo,代码行数:29,代码来源:TestEventsSection.cs

示例4: AddKnockoutDataBind

 public static void AddKnockoutDataBind(this IHtmlWriter writer, string name, DotvvmControl control, DotvvmProperty property, Action nullBindingAction = null,
     string valueUpdate = null, bool renderEvenInServerRenderingMode = false, bool setValueBack = false)
 {
     var expression = control.GetValueBinding(property);
     if (expression != null && (!control.RenderOnServer || renderEvenInServerRenderingMode))
     {
         writer.AddAttribute("data-bind", name + ": " + expression.GetKnockoutBindingExpression(), true, ", ");
         if (valueUpdate != null)
         {
             writer.AddAttribute("data-bind", "valueUpdate: '" + valueUpdate + "'", true, ", ");
         }
     }
     else
     {
         if (nullBindingAction != null) nullBindingAction();
         if (setValueBack && expression != null) control.SetValue(property, expression.Evaluate(control, property));
     }
 }
开发者ID:darilek,项目名称:dotvvm,代码行数:18,代码来源:KnockoutHelper.cs

示例5: RenderFileFieldLink

        /// <summary>
        /// Renders a link to the file field as a hyperlink tag. Rendering directives in the Action parameter will construct the body of the link. You may add attributes to the link by adding them to the writer before invoking this method.
        /// </summary>
        public static void RenderFileFieldLink(this HtmlTextWriter writer, IFileField fileField, Action linkBody)
        {
            if (!fileField.HasValue) return;

            writer.AddAttribute("href", fileField.Url);
            writer.RenderBeginTag("a");
            linkBody();
            writer.RenderEndTag();
        }
开发者ID:Gobiner,项目名称:Synthesis,代码行数:12,代码来源:HtmlTextWriterExtensions.cs

示例6: AddAttributes

 public static void AddAttributes(this HtmlTextWriter writer, IDictionary<string, object> attributes)
 {
   if (attributes!=null && attributes.Any())
   {
     foreach (KeyValuePair<string, object> attribute in attributes)
     {
       writer.AddAttribute(attribute.Key, attribute.Value.ToString(), true);
     }
   }
 }
开发者ID:ArthurYiL,项目名称:Yufu.EasyUI,代码行数:10,代码来源:HtmlTextWriterExtensions.cs

示例7: BeginTable

        internal static void BeginTable(this HtmlTextWriter writer, string border, string cellpadding, string cellspacing, string[] headings)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Border, border);
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, cellpadding);
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, cellspacing);
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Thead);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            foreach (var header in headings)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.Write(header);
                writer.RenderEndTag(); // Td
            }

            writer.RenderEndTag(); // Tr
            writer.RenderEndTag(); // Thead
        }
开发者ID:midspace,项目名称:SEToolbox,代码行数:19,代码来源:HtmlExtensions.cs

示例8: OpenTreeItem

 public static void OpenTreeItem(this HtmlTextWriter writer, string name, string id, string fontSize = "100%", bool isChecked = true)
 {
     writer.RenderBeginTag(HtmlTextWriterTag.Ul);
     writer.RenderBeginTag(HtmlTextWriterTag.Li);
     writer.AddAttribute(HtmlTextWriterAttribute.Type, "checkbox");
     if (isChecked)
     {
         writer.AddAttribute(HtmlTextWriterAttribute.Checked, "checked");
     }
     writer.AddAttribute(HtmlTextWriterAttribute.Id, id);
     writer.RenderBeginTag(HtmlTextWriterTag.Input);
     writer.RenderEndTag(); //INPUT
     writer.AddAttribute(HtmlTextWriterAttribute.For, id);
     writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "bold");
     writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, fontSize);
     writer.RenderBeginTag(HtmlTextWriterTag.Label);
     writer.Write(name);
     writer.RenderEndTag(); //LABEL
 }
开发者ID:TomDrJones,项目名称:NUnitGo,代码行数:19,代码来源:HtmlTextWriterExtensions.cs

示例9: AddPrevalueRow

        /// <summary>
        /// Adds a new row to the Prevalue Editor, (with an optional description).
        /// </summary>
        /// <param name="writer">The HtmlTextWriter.</param>
        /// <param name="label">The label for the field.</param>
        /// <param name="description">The description for the field.</param>
        /// <param name="controls">The controls for the field.</param>
        public static void AddPrevalueRow(this HtmlTextWriter writer, string label, string description, params Control[] controls)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row clearfix");
            writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'row'

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "label");
            writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'label'

            var lbl = new HtmlGenericControl("label") { InnerText = label };

            if (controls.Length > 0 && !string.IsNullOrEmpty(controls[0].ClientID))
            {
                lbl.Attributes.Add("for", controls[0].ClientID);
            }

            lbl.RenderControl(writer);

            writer.RenderEndTag(); // end 'label'

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "field");
            writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'field'

            foreach (var control in controls)
            {
                control.RenderControl(writer);
            }

            writer.RenderEndTag(); // end 'field'

            if (!string.IsNullOrEmpty(description))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "description");
                writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'description'

                var desc = new Literal() { Text = description };
                desc.RenderControl(writer);

                writer.RenderEndTag(); // end 'description'
            }

            writer.RenderEndTag(); // end 'row'
        }
开发者ID:elrute,项目名称:Triphulcas,代码行数:49,代码来源:PrevalueEditorExtensions.cs

示例10: AddAttributes

 public static void AddAttributes(this HtmlTextWriter writer, IDictionary<string, object> attributes)
 {
     if (attributes.Any<KeyValuePair<string, object>>())
     {
         foreach (var pair in attributes)
         {
             if (pair.Value != null)
                 writer.AddAttribute(pair.Key, pair.Value.ToString(), true);
         }
     }
 }
开发者ID:JeffersonNascimento,项目名称:SmartStoreNET,代码行数:11,代码来源:HtmlTextWriterExtensions.cs

示例11: BeginDocument

        internal static void BeginDocument(this HtmlTextWriter writer, string title, string inlineStyleSheet)
        {
            writer.AddAttribute("http-equiv", "Content-Type");
            writer.AddAttribute("content", "text/html;charset=UTF-8");
            writer.RenderBeginTag(HtmlTextWriterTag.Meta);
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Html);
            writer.RenderBeginTag(HtmlTextWriterTag.Style);
            writer.Write(inlineStyleSheet);
            writer.RenderEndTag(); // Style

            writer.RenderBeginTag(HtmlTextWriterTag.Head);
            writer.RenderBeginTag(HtmlTextWriterTag.Title);
            writer.Write(title);
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Body);
        }
开发者ID:midspace,项目名称:SEToolbox,代码行数:20,代码来源:HtmlExtensions.cs

示例12: AddTag

 public static void AddTag(this HtmlTextWriter writer, HtmlTextWriterTag tag,
     Dictionary<string, string> attributes1, 
     Dictionary<HtmlTextWriterAttribute, string> attributes2,
     string value = "")
 {
     foreach (var attribute in attributes1)
     {
         writer.AddAttribute(attribute.Key, attribute.Value);
     }
     foreach (var attribute in attributes2)
     {
         writer.AddAttribute(attribute.Key, attribute.Value);
     }
     writer.RenderBeginTag(tag);
     if (value != "")
     {
         writer.Write(value);
     }
     writer.RenderEndTag();
 }
开发者ID:TomDrJones,项目名称:NUnitGo,代码行数:20,代码来源:HtmlTextWriterExtensions.cs

示例13: AddAttributes

        public static void AddAttributes(this HtmlTextWriter writer, IDictionary<string, object> attributes)
        {
            Guard.IsNotNull(writer, "writer");

            if (!attributes.IsNullOrEmpty())
            {
                foreach (KeyValuePair<string, object> attribute in attributes)
                {
                    writer.AddAttribute(attribute.Key, attribute.Value.ToString(), true);
                }
            }
        }
开发者ID:juanplopes,项目名称:simple-telerik,代码行数:12,代码来源:HtmlTextWriterExtensions.cs

示例14: AddPrevalueHeading

        /// <summary>
        ///   Adds the prevalue row heading.
        /// </summary>
        /// <param name = "writer">The writer.</param>
        /// <param name = "heading">The heading.</param>
        public static void AddPrevalueHeading(this HtmlTextWriter writer, string heading)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row clearfix");
            writer.RenderBeginTag(HtmlTextWriterTag.Div); // start 'row'

            writer.RenderBeginTag(HtmlTextWriterTag.H3); // start 'h3'

            writer.Write(heading);

            writer.RenderEndTag(); // end 'h3'

            writer.RenderEndTag(); // end 'row'
        }
开发者ID:ZeeshanShafqat,项目名称:Aspose_Imaging_NET,代码行数:18,代码来源:PrevalueEditorExtensions.cs

示例15: AddScreenshots

 public static HtmlTextWriter AddScreenshots(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string id = "")
 {
     writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id);
     writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px");
     writer.RenderBeginTag(HtmlTextWriterTag.Div);
     var screens = nunitGoTest.Screenshots.OrderBy(x => x.Date);
     foreach (var screenshot in screens)
     {
         writer.Write("Screenshot (Date: " + screenshot.Date.ToString("dd.MM.yy HH:mm:ss.fff") + "):");
         writer.AddAttribute(HtmlTextWriterAttribute.Href, @"./../../Screenshots/" + screenshot.Name);
         writer.RenderBeginTag(HtmlTextWriterTag.A);
         writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
         writer.AddAttribute(HtmlTextWriterAttribute.Src, @"./../../Screenshots/" + screenshot.Name);
         writer.AddAttribute(HtmlTextWriterAttribute.Alt, screenshot.Name);
         writer.RenderBeginTag(HtmlTextWriterTag.Img);
         writer.RenderEndTag();//IMG
         writer.RenderEndTag();//A
     }
     if(!screens.Any())
         writer.Write("There are no screenshots in this test");
     writer.RenderEndTag();//DIV
     return writer;
 }
开发者ID:elv1s42,项目名称:NUnitGo,代码行数:23,代码来源:ScreenshotsSection.cs


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