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


C# Button.As方法代码示例

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


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

示例1: DisplayChange


//.........这里部分代码省略.........
				HintsData.IsChangeInactive = true;

				AddLabel(String.Format("<br>This review has been {0}.", (changeList.Stage == 2 ? "closed" : "deleted")));
				return;
			}

			AddLabel("<h3>Vote so far</h3>");

			TableGen.Table reviewerVote = new TableGen.Table(2) { CssClass = "CssChangeListVoteHistory" };
			ActivePage.Controls.Add(reviewerVote);

			var reviewerQuery = from rv in DataContext.Reviewers where rv.ChangeListId == cid select rv;
			Reviewer[] reviewers = reviewerQuery.ToArray();
			bool iAmAReviewer = false;
			foreach (Reviewer reviewer in reviewers)
			{
				var row = reviewerVote.CreateRow();
				reviewerVote.AddItem(row);

				row[0].Text = reviewer.ReviewerAlias;

				if (userName.EqualsIgnoreCase(reviewer.ReviewerAlias))
				{
					DropDownList list = new DropDownList() { ID = "verdictlist" };
					row[1].Add(list);

					list.Items.Add(new ListItem() { Text = "Needs work" });				
					list.Items.Add(new ListItem() { Text = "LGTM with minor tweaks" });
					list.Items.Add(new ListItem() { Text = "LGTM" });
					list.Items.Add(new ListItem() { Text = "Non-scoring comment" });

					iAmAReviewer = true;
				}
				else if (!Page.IsPostBack)
				{
					Review review = GetLastReview(cid, reviewer.ReviewerAlias);
					if (review == null)
					{
						row[1].Text = "Have not looked";
					}
					else
					{
						row[1].Add(new HyperLink()
						{
							Text = Malevich.Util.CommonUtils.ReviewStatusToString(review.OverallStatus),
							NavigateUrl = Request.FilePath + "?rid=" + review.Id,
						});
					}
				}
			}

			bool iOwnTheChange = changeList.UserName.EqualsIgnoreCase(userName);
			if (!iAmAReviewer && !iOwnTheChange)
			{
				AddLabel("<br>");
				AddLink("I would like to review this change.", "?cid=" + changeList.Id + "&action=makemereviewer")
					.AppendCSSClass("button");
			}

			if (iOwnTheChange && changeList.Stage != 2 && /* 2 = closed */
				GetChangeListStatus(changeList) == ChangeListStatus.Closable)
			{
				AddLabel("<br>");
				AddLink("Close Review", "?cid=" + changeList.Id + "&action=close")
					.AppendCSSClass("button");
			}

			if (iOwnTheChange)
			{
				HintsData.IsChangeAuthor = true;
				AddLabel("<h3>My response</h3>");
			}
			else
			{
				HintsData.IsChangeReviewer = true;
				AddLabel("<h3>My comments</h3>");
			}

			TextBox commentTextBox = new TextBox();
			ActivePage.Controls.Add(commentTextBox);
			commentTextBox.TextMode = TextBoxMode.MultiLine;
			commentTextBox.AppendCSSClass("CssGeneralCommentInputBox");
			commentTextBox.ID = "reviewcommenttextbox";

			AddLabel("<br>");

			Button submitReviewButton =
				new Button() { ID = "submitreviewbutton", Text = "Submit", CssClass = "button" };
			ActivePage.Controls.Add(submitReviewButton.As(HtmlTextWriterTag.P));
			submitReviewButton.Click += new EventHandler(
				delegate(object sender, EventArgs e) { submitReview_Clicked(cid, sender, e); });

			AddLabel("<br>");

			int myReviewId = GetBaseReviewId(userName, cid);
			if (myReviewId == 0)
				return;

			DisplayReviewLineComments(myReviewId);
		}
开发者ID:daptiv,项目名称:Malevich,代码行数:101,代码来源:Default.aspx.cs


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