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


C# Button.RenderControl方法代码示例

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


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

示例1: Button_Render2

		public void Button_Render2 () {
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			
			Button b = new Button ();
			b.ID = "MyButton";
			b.Text = "Hello";
			b.UseSubmitBehavior = false;
			b.Enabled = false;
			b.ToolTip = "Hello_ToolTip";
			b.RenderControl (tw);
			
			string strTarget = "<input type=\"button\" name=\"MyButton\" value=\"Hello\" disabled=\"disabled\" title=\"Hello_ToolTip\" />";
			string str = sw.ToString();
			HtmlDiff.AssertAreEqual (strTarget, str, "Button_Render2");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:16,代码来源:ButtonTest.cs

示例2: IgnoresChildren

		public void IgnoresChildren ()
		{
			Button b = new  Button ();
			b.Controls.Add (new LiteralControl ("hola"));
			Assert.AreEqual (1, b.Controls.Count, "controls");
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			b.RenderControl (tw);
			string str = tw.ToString ();
			Assert.AreEqual (-1, str.IndexOf ("hola"), "hola");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:11,代码来源:ButtonTest.cs

示例3: RenderAvaliacoes


//.........这里部分代码省略.........
                        }
                        NothingToDo = false;
                        row.Cells.Add(cel);
                    }
                }
                else
                {
                    int pos = -1;
                    bool found = false;
                    foreach (String qualidade in currProjecto.GroupsCodes)
                    {
                        pos++;
                        if (qualidade == t.Qualidade)
                        {
                            found = true;
                            break;
                        }

                    }
                    if (found)
                    {
                        cel = new TableCell();
                        cel.Attributes.Add("class", "Qualidade");
                        cel.Text = currProjecto.GroupsDescription[pos];
                        row.Cells.Add(cel);
                        NothingToDo = false;
                    }
                }

                cel = new TableCell();
                cel.Attributes.Add("class", "dataLimte");
                cel.Text = t.Projecto.DataFim.ToString("yyyy-MM-dd");
                row.Cells.Add(cel);

                cel = new TableCell();

                if (DateTime.Now.Date > t.Projecto.DataFim)
                {
                    cel.Text = dic.getResource(25);  //"Processo Encerrado";
                }
                else
                {
                    Button bot = new Button();
                    bot.Attributes.Add("class", "avaliaBot");

                    bot.ID = "bot" + t.Proprio.PessoaID.ToString() + "A" + t.Avaliado.PessoaID.ToString();
                    if ((t.DataInicio != DateTime.MinValue) && !t.completo)
                    {
                        bot.Text = dic.getResource(34);  // "Continuar";
                        bot.ForeColor = Color.Red;
                    }
                    else
                        bot.Text = dic.getResource(33);  //"Avaliar";

                    bot.PostBackUrl = "FO_TakeSurvey.aspx?ticket=" + t.Chave;
                    bot.UseSubmitBehavior = false;

                    //if (bot.Text == "Continuar")
                    //    bot.OnClientClick = "gotoPage('FO_GetInstructions.aspx?ticket=" + t.Chave + "');";
                    //else
                    bot.OnClientClick = "gotoPage('FO_GetInstructions.aspx?ticket=" + t.Chave + "');";

                    cel.Attributes.Add("class", "agrupa");
                    cel.Controls.Add(bot);
                }
                row.Cells.Add(cel);
                table.Rows.Add(row);
            }
            if (!NothingToDo)
            {
                output.Write("<p></p>");
                output.Write("<h3>" + dic.getResource(26) + "</h3>");
                table.RenderControl(output);
            }

            script = true;
            output.Write("<script type='text/javascript'>function gotoPage(dest){var count = 0;chekes = document.getElementsByTagName('input');for (i = 0; i < chekes.length; ++i) {if (chekes[i].checked) count++;}if (count > 1) {var x = document.getElementById('hiddenText');x.value = 'GRUPO';theForm.submit();} else {window.location = dest;}}</script>");
            output.Write("<script type='text/javascript'>function gotoCancelPage(ticketID){window.location = 'FO_CancelInvitation.aspx?ticketID=' + ticketID;}</script>");

            if (count >= 1)
            {
                Button b = new Button();
                b.Text = dic.getResource(27); //"Avaliar os elementos seleccionados em conjunto";
                b.UseSubmitBehavior = true;
                b.ID = "botAVGrupo";

                b.OnClientClick = "avaliaGrupo();";
                b.Style.Add(HtmlTextWriterStyle.Visibility, "hidden");

                b.RenderControl(output);
                String clientID = b.ClientID;

                output.Write("<input type=\"hidden\" name=\"hiddenText\" id=\"hiddenText\"/>");
                output.Write("<script type='text/javascript'>function avaliaGrupo(){var x = document.getElementById('hiddenText');x.value = 'GRUPO';}");
                output.Write("function validaGrupo(nomeGrupo){var aviso = false;var count = 0;chekes = document.getElementsByTagName('input');");
                output.Write("var bot = document.getElementById(\"" + clientID + "\");for (i=0;i<chekes.length;++ i){if (chekes[i].id.indexOf(nomeGrupo) < 0 && chekes[i].type == \"checkbox\" && chekes[i].checked)");
                output.Write("{ chekes[i].checked = false;aviso = true;} if(chekes[i].checked) count++; }if(count > 1) { bot.style.visibility = \"visible\"; } else { bot.style.visibility = \"hidden\"; } if(aviso) alert(\"" + dic.getResource(28) + "\");}</script>");

            }
        }
开发者ID:JCanhoto,项目名称:ToolsQtools,代码行数:101,代码来源:TodoTable.cs

示例4: Button_Render

		public void Button_Render ()
		{
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);

			Button b = new Button ();
			b.Text = "Hello";
			b.RenderControl (tw);
			
			Assert.AreEqual (true, sw.ToString().IndexOf ("value=\"Hello\"") != -1, "A4");
			Assert.AreEqual (true, sw.ToString().IndexOf ("<input") != -1, "A5");
			Assert.AreEqual (true, sw.ToString().IndexOf ("type=\"submit\"") != -1, "A6");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:13,代码来源:ButtonTest.cs

示例5: Render

        protected override void Render(HtmlTextWriter writer)
        {
            if (!DesignMode)
            {
                EFClientTools.ClientUtility.ClientInfo.cErrorCode = 8040;

                if (Postback)
                {
                    Button button = new Button();
                    button.ID = this.ID;
                    button.Text = this.Text;
                    //if (!this.Page.IsPostBack)
                    //{
                    //    if (!string.IsNullOrEmpty(OnClick))
                    //    {
                    //        //var method = this.Page.GetType().GetMethod("Button1_Click", BindingFlags.NonPublic | BindingFlags.Instance);
                    //       // var clickEvent = button.GetType().GetEvent("Click");
                    //       // clickEvent.AddEventHandler(button, Delegate.CreateDelegate(clickEvent.EventHandlerType, this.Page, OnClick));
                    //        //button.Click +=
                    //        //button.Click +=new EventHandler(button_Click);
                    //    }
                    //}
                    button.RenderControl(writer);
                }
                else
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ID);
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, JQControl.LinkButton);
                    if (!string.IsNullOrEmpty(OnClick))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Onclick, string.Format("{0}();", OnClick));
                    }
                    writer.AddAttribute(JQProperty.DataOptions, DataOptions);
                    writer.RenderBeginTag(HtmlTextWriterTag.A);

                    writer.Write(Text);
                    writer.RenderEndTag();
                }

                EFClientTools.ClientUtility.ClientInfo.cErrorCode = 0;
            }
        }
开发者ID:san90279,项目名称:UK_OAS,代码行数:42,代码来源:JQButton.cs


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