本文整理汇总了C#中System.Web.Mvc.HtmlHelper.ActionLink方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlHelper.ActionLink方法的具体用法?C# HtmlHelper.ActionLink怎么用?C# HtmlHelper.ActionLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Mvc.HtmlHelper
的用法示例。
在下文中一共展示了HtmlHelper.ActionLink方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TitleUrl
public MvcHtmlString TitleUrl(HtmlHelper helper)
{
switch (ProjectType)
{
case SourceProjectType.DEPOSIT:
return helper.ActionLink(ProjectTitle, "Project", "DataDeposit", new {id = ProjectId}, new {});
default:
return helper.ActionLink(ProjectTitle, "Project", "Project", new {id = ProjectId}, new {});
}
}
示例2: AddActionModalWindow
public static HtmlString AddActionModalWindow(HtmlHelper helper, string headText, string bodyText,
string actionName,
string controlName, object paramsList, string applyButtonName, string id)
{
var a = helper.ActionLink(applyButtonName, actionName, controlName, paramsList,
new { @class = "btn btn-default", @id = "CauseLink" });
var result = "<div id='modalWindow" + id + "' class='modal fade' role='dialog'>" +
"<div class='modal-dialog'>" +
"<div class='modal-content'>" +
"<div class='modal-header'>" +
"<button type='button' class='close' data-dismiss='modal'>×</button>" +
"<h4 class='modal-title'>" + headText + "</h4>" +
"</div>" +
"<div class='modal-body'>" +
"<p>" + bodyText + "</p>" +
"</div>" +
"<div class='modal-footer'>" +
"<button type='button' class='btn btn-default' data-dismiss='modal'>Отмена</button>" +
a.ToString() +
"</div>" +
"</div>" +
"</div>" +
"</div>";
return new HtmlString(result);
}
示例3: AddNavigationNode
public static string AddNavigationNode(HtmlHelper htmlHelper, NavigationNode node)
{
StringBuilder nodeOutput = new StringBuilder();
if (node.Children.Count == 0)
{
nodeOutput.Append("<li>");
}
else
{
nodeOutput.Append("<li class=\"dropdown\">");
}
if (node.Children.Count == 0)
{
nodeOutput.Append(htmlHelper.ActionLink(node.Name, node.Action, node.Controller).ToString());
}
else
{
nodeOutput.Append(string.Format(@"<a href=""#"" class=""dropdown-toggle"" data-toggle=""dropdown"">{0}<b class=""caret""></b></a>", node.Name));
nodeOutput.Append(AddSubMenu(htmlHelper, node.Children));
}
nodeOutput.Append("</li>");
return nodeOutput.ToString();
}
示例4: AddMenu
static void AddMenu(HtmlHelper html, string controllerName, string actionName, string linkText,
string currentControllerName, StringBuilder output)
{
if (currentControllerName == controllerName)
output.Append("<li class=\"active\">");
else
{
output.Append("<li>");
}
output.Append(html.ActionLink(linkText, actionName, controllerName).ToHtmlString());
output.Append("</li>");
}
示例5: BidsummaryLinks
public void BidsummaryLinks(dynamic display, TextWriter output, HtmlHelper html, ContentItem item, int count, int pendingCount) {
var bidText = "";
if (item.Id != 0) {
var totalBidCount = count + pendingCount;
var totalBidText = T.Plural("1 Bid", "{0} Bids", totalBidCount);
if (totalBidCount == 0) {
bidText += totalBidText.ToString();
}
else {
bidText +=
html.ActionLink(
totalBidText.ToString(),
"Details",
new {
Area = "Devq.Bids",
Controller = "Admin",
id = item.Id,
returnUrl = html.ViewContext.HttpContext.Request.ToUrlString()
});
}
if (pendingCount > 0) {
bidText += " " + html.ActionLink(T("({0} pending)", pendingCount).ToString(),
"Details",
new {
Area = "Devq.Bids",
Controller = "Admin",
id = item.Id,
returnUrl = html.ViewContext.HttpContext.Request.Url
});
}
}
output.Write(bidText);
}
示例6: CommentSummaryLinks
public void CommentSummaryLinks(dynamic Display, TextWriter Output, HtmlHelper Html, ContentItem item, int count, int pendingCount) {
var commentText = "";
if (item.Id != 0) {
var totalCommentCount = count + pendingCount;
var totalCommentText = T.Plural("1 comment", "{0} comments", totalCommentCount);
if (totalCommentCount == 0) {
commentText += totalCommentText.ToString();
}
else {
commentText +=
Html.ActionLink(
totalCommentText.ToString(),
"Details",
new {
Area = "Orchard.Comments",
Controller = "Admin",
id = item.Id,
returnUrl = Html.ViewContext.HttpContext.Request.ToUrlString()
});
}
if (pendingCount > 0) {
commentText += " " + Html.ActionLink(T("({0} pending)", pendingCount).ToString(),
"Details",
new {
Area = "Orchard.Comments",
Controller = "Admin",
id = item.Id,
returnUrl = Html.ViewContext.HttpContext.Request.Url
});
}
}
Output.Write(commentText);
}
示例7: AddActionModalWindowWithTextBox
public static HtmlString AddActionModalWindowWithTextBox(HtmlHelper helper, string headText, string actionName, string controlName, object paramsList, string applyButtonName, string id,
string textBoxName)
{
var link = helper.ActionLink(applyButtonName, actionName, controlName, paramsList,
new {@class = "btn btn-default", @id = "link" + id});
var modalWindow =
"<div id='modalWindow" + id + "' class='modal fade' role='dialog'>" +
"<div class='modal-dialog'>" +
"<div class='modal-content'>" +
"<div class='modal-header'>" +
"<button type='button' class='close' data-dismiss='modal'>×</button>" +
"<h4 class='modal-title'>" + headText + "</h4>" +
"</div>" +
"<div class='modal-body'>" +
"<textarea class='form-control' rows='3' id='" + textBoxName + id +"' style='resize:none'></textarea>" +
"</div>" +
"<div class='modal-footer'>" +
"<button type='button' class='btn btn-default' data-dismiss='modal'>Отмена</button>" + link +
"</div>" +
"</div>" +
"</div>" +
"</div>";
var script = "<script type='text/javascript'> $(function() {" +
"$('#link" + id + "').click(function () {" +
"var name = $('#" + textBoxName + id + "').val();" +
"this.href = this.href + '&" + textBoxName + "=' + encodeURIComponent(name);" +
"});" +
"});" +
"</script>";
var result = modalWindow + script;
return new HtmlString(result);
}
示例8: EditLink
public override MvcHtmlString EditLink(HtmlHelper htmlHelper)
{
return htmlHelper.ActionLink<CmsController>(c => c.Edit(ContentId), "Edit");
}
示例9: Link
public override MvcHtmlString Link(HtmlHelper htmlHelper)
{
return htmlHelper.ActionLink(Name, Action, Controller);
}
示例10: AccountRegisterLink
public static MvcHtmlString AccountRegisterLink(HtmlHelper htmlHelper)
{
return htmlHelper.ActionLink("新しいユーザーとして登録する", AccountController.ActionNames.Register, ControllerNames.Account);
}
示例11: AddMobileNavigationNode
public static string AddMobileNavigationNode(HtmlHelper htmlHelper, NavigationNode node, string dataTheme, string dataContentTheme)
{
StringBuilder nodeOutput = new StringBuilder();
if (node.Children.Count > 0)
{
nodeOutput.Append(string.Format("<div data-role=\"collapsible\" data-theme=\"{0}\" data-content-theme=\"{1}\">", dataTheme, dataContentTheme));
}
if (node.Children.Count == 0)
{
nodeOutput.Append(htmlHelper.ActionLink(node.Name, node.Action, node.Controller, null, new { data_role="button", rel="external" }).ToString());
}
else
{
nodeOutput.Append(AddMobileSubMenu(htmlHelper, node.Children));
}
if (node.Children.Count > 0)
{
nodeOutput.Append("</div>");
}
return nodeOutput.ToString();
}