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


C# HtmlTextWriter.WriteBeginTag方法代码示例

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


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

示例1: RenderContents

        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (Extender.AdapterEnabled)
            {
                LinkButton linkButton = Control as LinkButton;
                if (linkButton != null)
                {
                    string className = (!String.IsNullOrEmpty(linkButton.CssClass)) ? (linkButton.CssClass) : "AspNet-LinkButton";

                    Control ctl = linkButton.FindControl("ctl00");
                    if (ctl != null)
                    {
                        writer.WriteBeginTag("a");
                        writer.WriteAttribute("id", linkButton.ClientID);
                        writer.WriteAttribute("title", linkButton.ToolTip);
                        writer.WriteAttribute("class", className);
                        writer.WriteAttribute("href", Page.ClientScript.GetPostBackClientHyperlink(linkButton, ""));
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.WriteBeginTag("span");
                        writer.WriteAttribute("class", "AspNet-LinkButton-Text");
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Write(linkButton.Text);
                        writer.WriteEndTag("span");
                        writer.WriteEndTag("a"); Page.ClientScript.RegisterForEventValidation(linkButton.UniqueID);
                    }
                    else
                    {
                        base.RenderContents(writer);
                    }
                }
            }
        }
开发者ID:JenasysDesign,项目名称:BootstrapControlAdapters,代码行数:32,代码来源:LinkButtonAdapter.cs

示例2: ShowPropertyGrid

        /// <summary>
        /// Creates a simplistic Property Grid to display of an object
        /// </summary>
        /// <returns></returns>
        public static string ShowPropertyGrid(object sourceObject)
        {
            if (sourceObject == null)
                return "<hr/>No object passed.<hr/>";

            StringBuilder sb = new StringBuilder();
            using (StringWriter sw = new StringWriter(sb))
            {
                using (HtmlTextWriter hWriter = new HtmlTextWriter(sw))
                {
                    hWriter.WriteBeginTag("table");
                    hWriter.WriteAttribute("border", "1");
                    hWriter.WriteAttribute("cellpadding", "5");
                    hWriter.WriteAttribute("class", "table table-bordered table-striped");
                    hWriter.Write(" style='border-collapse:collapse;'");
                    hWriter.Write(HtmlTextWriter.TagRightChar);
                    MemberInfo[] miT = sourceObject.GetType().FindMembers(MemberTypes.Field | MemberTypes.Property, BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, null);
                    foreach (MemberInfo Field in miT)
                    {
                        string Name = Field.Name;
                        object Value = null;
                        if (Field.MemberType == MemberTypes.Field)
                        {
                            Value = ((FieldInfo)Field).GetValue(sourceObject);
                            continue;
                        }
                        else
                            if (Field.MemberType == MemberTypes.Property)
                                Value = ((PropertyInfo)Field).GetValue(sourceObject, null);
                        hWriter.WriteFullBeginTag("tr");
                        hWriter.WriteFullBeginTag("td");
                        hWriter.Write(Name);
                        hWriter.WriteEndTag("td");
                        hWriter.WriteLine();
                        hWriter.WriteFullBeginTag("td");
                        hWriter.WriteBeginTag("input");
                        hWriter.WriteAttribute("name", "Configuration." + Name);
                        hWriter.WriteAttribute("value", ReflectionUtils.TypedValueToString(Value));
                        hWriter.Write(" style='Width:400px' ");
                        hWriter.Write(HtmlTextWriter.TagRightChar);
                        hWriter.WriteEndTag("td");
                        hWriter.WriteLine();
                        hWriter.WriteEndTag("tr");
                        hWriter.WriteLine();
                    }
                    hWriter.WriteEndTag("table");
                    //string TableResult = sb.ToString();
                    hWriter.Close();
                }
                sw.Close();
            }

            return sb.ToString();
        }
开发者ID:Acaspita,项目名称:Westwind.ApplicationConfiguration,代码行数:58,代码来源:SamplesViewModel.cs

示例3: Render

        protected override void Render(HtmlTextWriter writer)
        {
            int rowCount = 0;
            writer.WriteBeginTag("table");
            writer.WriteAttribute("id", this.ClientID);
            writer.WriteAttribute("class", this.CssClass);
            writer.WriteAttribute("summary", this.TableSummary);
            writer.Write(HtmlTextWriter.TagRightChar);

            foreach (RepeaterItem ri in Items)
            {
                if (rowCount == 0)
                {
                    writer.WriteBeginTag("tr");
                    writer.Write(HtmlTextWriter.TagRightChar);
                }

                writer.WriteBeginTag("td");
                writer.Write(HtmlTextWriter.TagRightChar);
                ri.RenderControl(writer);
                writer.WriteEndTag("td");

                if (rowCount == this.ColumnCount - 1)
                {
                    writer.WriteEndTag("tr");
                    rowCount = 0;
                }
                else
                {
                    rowCount++;
                }
            }

            if (rowCount > 0)
            {
                //write any remaining td's
                while (rowCount < this.ColumnCount)
                {
                    writer.WriteBeginTag("td");
                    writer.Write(HtmlTextWriter.TagRightChar);
                    writer.Write("&nbsp;");
                    writer.WriteEndTag("td");
                    rowCount++;
                }

                writer.WriteEndTag("tr");
                //writer.cl
            }

            writer.WriteEndTag("table");
        }
开发者ID:rrmarriott,项目名称:DirectSports,代码行数:51,代码来源:ProductLister.cs

示例4: Render

        protected override void Render(HtmlTextWriter output)
        {
            //begin writing table
            output.WriteBeginTag("table");
            output.WriteAttribute("cellpadding", "0");
            output.WriteAttribute("cellspacing", "0");

            output.Write(HtmlTextWriter.TagRightChar);

            //begin writing row
            output.WriteBeginTag("tr");
            output.Write(HtmlTextWriter.TagRightChar);

            //write first column
            output.WriteBeginTag("td");

            string style = "width: " + CaptionWidth.ToString() + ";";

            if (RightAlignCaption)
                style += "text-align: right;";

            output.WriteAttribute("Style", style);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write(Caption);
            output.WriteEndTag("td");

            //write second column
            output.WriteBeginTag("td");

            style = "width: " + CaptionPadding.ToString() + ";";

            output.WriteAttribute("Style", style);

            output.Write(HtmlTextWriter.TagRightChar);
            output.WriteEndTag("td");

            //write third column
            output.WriteBeginTag("td");
            output.Write(HtmlTextWriter.TagRightChar);

            base.Render(output);    // this renders the TextBox

            output.WriteEndTag("td");

            //finish writing row
            output.WriteEndTag("tr");

            //finish writing table
            output.WriteEndTag("table");
        }
开发者ID:ndcunningham,项目名称:Utech-Imagine-Cup,代码行数:50,代码来源:CaptionedBox.cs

示例5: Render

 protected override void Render(HtmlTextWriter writer)
 {
     writer.WriteBeginTag("object");
     writer.WriteAttribute("type", "application/x-shockwave-flash");
     writer.WriteAttribute("style", "width:425px; height:350px;");
     writer.WriteAttribute("data=", this._videoID);
     writer.Write('>');
     writer.WriteBeginTag("param");
     writer.WriteAttribute("name", "movie");
     writer.WriteAttribute("value", this._videoID);
     writer.Write(" />");
     writer.WriteEndTag("object");
     base.Render(writer);
 }
开发者ID:wjkong,项目名称:MicNets,代码行数:14,代码来源:ctlVideoViewer.ascx.cs

示例6: RenderChildren

        protected override void RenderChildren(HtmlTextWriter writer)
        {
            writer.WriteFullBeginTag("span");
            writer.WriteFullBeginTag("i");
            writer.Write("Pimp your SharePoint by using ton's of sample data.. ");
            writer.WriteBeginTag("br");
            writer.Write(HtmlTextWriter.SelfClosingTagEnd);
            writer.Write("Just hit the buttons to add sample data.");
            writer.WriteEndTag("i");
            writer.WriteEndTag("span");
            writer.WriteBeginTag("br");
            writer.Write(HtmlTextWriter.SelfClosingTagEnd);

            base.RenderChildren(writer);
        }
开发者ID:ThorstenHans,项目名称:DotNetRocks,代码行数:15,代码来源:DeploySampleData.cs

示例7: Render

        /// <exclude />
        protected override void Render(HtmlTextWriter writer)
        {
            writer.WriteBeginTag("ui:checkbox");

            writer.WriteAttribute("label", StringResourceSystemFacade.ParseString(this.ItemLabel ?? ""));

            if (!string.IsNullOrEmpty(this.ToolTip))
            {
                writer.WriteAttribute("title", StringResourceSystemFacade.ParseString(this.ToolTip ?? ""));
            }

            writer.WriteAttribute("name", this.UniqueID);

            if (this.AutoPostBack)
            {
                writer.WriteAttribute("callbackid", this.ClientID);
                writer.WriteAttribute("oncommand", "this.dispatchAction(PageBinding.ACTIONEVENT_DOPOSTBACK);");
            }

            writer.WriteAttribute("ischecked", this.Checked.ToString().ToLower());

            this.WriteClientAttributes(writer);

            writer.Write(HtmlTextWriter.SelfClosingTagEnd);
        }
开发者ID:Orckestra,项目名称:C1-CMS,代码行数:26,代码来源:CheckBox.cs

示例8: Render

        protected override void Render(HtmlTextWriter writer)
        {
            Button button = this.Control;

            writer.WriteBeginTag("button"); // <button 
            writer.WriteAttribute("value", "submit"); // <button value="submit" 
            writer.WriteAttribute("id", button.ClientID); // <button value="submit" id="btnButton"

            PostBackOptions myPostBackOptions = new PostBackOptions(button);
            //Add the Postback event
            if (button.Page.ClientScript.GetPostBackEventReference(myPostBackOptions).Length > 0)
            {
                //Turn on Validation if it needs to be on...
                if (button.CausesValidation)
                    myPostBackOptions.PerformValidation = true;

                //Need to replace double quotes with single quotes for javascript to work.
                writer.WriteAttribute("onclick", button.Page.ClientScript.GetPostBackEventReference(myPostBackOptions).Replace("\"", "'")); // <button value="submit" 

                //Register the Event
                button.Page.ClientScript.RegisterForEventValidation(myPostBackOptions);
            } // <button value="submit" id="btnButton" onclick="__doPostBack('btnButton','')"

            if (button.CssClass.Length > 0)
                writer.WriteAttribute("class", button.CssClass); // <button value="submit" id="btnButton" onclick="__doPostBack('btnButton','')" class="large-button"

            writer.Write(HtmlTextWriter.TagRightChar); // <button value="submit" id="btnButton" onclick="__doPostBack('btnButton','')" class="large-button">
            writer.WriteFullBeginTag("span");
            writer.Write(button.Text);
            writer.WriteEndTag("span"); // <button value="submit" id="btnButton" onclick="__doPostBack('btnButton','')" class="large-button"><span>testButton</span>
            writer.WriteEndTag("button"); // <button value="submit" id="btnButton" onclick="__doPostBack('btnButton','')" class="large-button"><span>testButton</span></button>
        }
开发者ID:JBeans99,项目名称:CSharp__.NET,代码行数:32,代码来源:ButtonAdapter.cs

示例9: RenderMetaTag

 private void RenderMetaTag(HtmlTextWriter writer, string name, string content)
 {
     writer.WriteBeginTag("meta");
     writer.WriteAttribute("name",name,true);
     writer.WriteAttribute("content",content,true);
     writer.WriteLine(HtmlTextWriter.SelfClosingTagEnd);
 }
开发者ID:sffogg,项目名称:Xenosynth,代码行数:7,代码来源:MetaTag.cs

示例10: WriteFooter

        public static void WriteFooter(HtmlTextWriter wrtr, Type type,
            bool autoDocVersion)
        {
            wrtr.WriteBeginTag("div");
              wrtr.WriteAttribute("id", "content");
              wrtr.Write(HtmlTextWriter.TagRightChar);
              wrtr.WriteLine();

              wrtr.WriteFullBeginTag("h2");
              wrtr.Write("&nbsp;");
              wrtr.WriteEndTag("h2");
              wrtr.WriteLine();

              if (autoDocVersion)
              {
            AssemblyName name1 = type.Assembly.GetName();
            wrtr.Write("{0} {1}.{2}.{3}&nbsp;&nbsp;&nbsp;", name1.Name,
              name1.Version.Major, name1.Version.Minor, name1.Version.Build);

            AssemblyName name2 = typeof(XmlRpcServerProtocol).Assembly.GetName();
            wrtr.Write("{0} {1}.{2}.{3}&nbsp;&nbsp;&nbsp;", name2.Name,
              name2.Version.Major, name2.Version.Minor, name2.Version.Build);

            wrtr.Write(".NET CLR {0}.{1}.{2}&nbsp;&nbsp;&nbsp;",
              Environment.Version.Major,Environment.Version.Minor,
              Environment.Version.Build);
              }
              wrtr.WriteEndTag("div");
              wrtr.WriteLine();
        }
开发者ID:jbrunken,项目名称:ActiveForumsTapatalkXmlRpc,代码行数:30,代码来源:XmlRpcDocWriter.cs

示例11: Render

        /// <exclude />
        protected override void Render(HtmlTextWriter writer)
        {
            writer.WriteBeginTag("ui:errorset");
            writer.WriteAttribute("timestamp", HttpUtility.HtmlAttributeEncode(DateTime.Now.Ticks.ToString()));
            writer.Write(HtmlTextWriter.TagRightChar);
            

            writer.WriteBeginTag("ui:error");

            writer.WriteAttribute("text", HttpUtility.HtmlAttributeEncode(StringResourceSystemFacade.ParseString(this.Text)));
            writer.WriteAttribute("targetname", HttpUtility.HtmlAttributeEncode(this.TargetName));

            writer.Write(HtmlTextWriter.SelfClosingTagEnd);

            writer.WriteEndTag("ui:errorset");
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:17,代码来源:FieldMessage.cs

示例12: RenderBeginTag

        protected override void RenderBeginTag(HtmlTextWriter writer)
        {
            if ((Control != null) && (Control.Attributes["CssSelectorClass"] != null) && (Control.Attributes["CssSelectorClass"].Length > 0))
            {
                writer.WriteLine();
                writer.WriteBeginTag("div");
                writer.WriteAttribute("class", Control.Attributes["CssSelectorClass"]);
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Indent++;
            }

            writer.WriteLine();
            writer.WriteBeginTag("div");
            writer.WriteAttribute("class", "AspNet-Menu-" + Control.Orientation.ToString());
            writer.Write(HtmlTextWriter.TagRightChar);
        }
开发者ID:paulallies,项目名称:NMPIB,代码行数:16,代码来源:MenuAdapter.cs

示例13: RenderSelfClose

 private void RenderSelfClose(HtmlTextWriter writer)
 {
     writer.WriteBeginTag(TagName);
     RenderAttributes(writer);
     writer.Write(HtmlTextWriter.SelfClosingTagEnd);
     RenderChildren(writer);
 }
开发者ID:diegodfsd,项目名称:XHtmlFluent,代码行数:7,代码来源:HtmlGeneric.cs

示例14: BuildItems

		private void BuildItems(TreeNodeCollection items, bool isRoot, bool isExpanded, HtmlTextWriter writer)
		{
			if (items.Count > 0)
			{
				writer.WriteLine();

				writer.WriteBeginTag("ul");

				if (isRoot)
				{
					writer.WriteAttribute("id", this.ClientID);
				}
				writer.Write(HtmlTextWriter.TagRightChar);
				writer.Indent++;

				foreach (System.Web.UI.WebControls.TreeNode item in items)
				{
					BuildItem(item, writer);
				}

				writer.Indent--;
				writer.WriteLine();
				writer.WriteEndTag("ul");
			}
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:25,代码来源:TreeView.cs

示例15: RenderOptionGroupBeginTag

 private static void RenderOptionGroupBeginTag(string name, HtmlTextWriter writer)
 {
     writer.WriteBeginTag("optgroup");
     writer.WriteAttribute("label", name);
     writer.Write('>');
     writer.WriteLine();
 }
开发者ID:ranyaof,项目名称:Meuhedet,代码行数:7,代码来源:DropDownListAdapter.cs


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