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


C# HtmlHelper.ActionLink方法代码示例

本文整理汇总了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 {});
            }

        }
开发者ID:SharePointSusan,项目名称:Research-Data-Manager,代码行数:11,代码来源:ProjectListViewModel.cs

示例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'>&times;</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);
        }
开发者ID:DoctorSoft,项目名称:HospitalAPI,代码行数:27,代码来源:ModalWindowsHelper.cs

示例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();
        }
开发者ID:modulexcite,项目名称:framework-1,代码行数:27,代码来源:NavigationExtensions.cs

示例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>");
        }
开发者ID:vincentzh,项目名称:aqh_daily_report,代码行数:12,代码来源:Html.cs

示例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);
        }
开发者ID:Devqon,项目名称:Devq.Bids,代码行数:36,代码来源:Shapes.cs

示例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);
        }
开发者ID:anycall,项目名称:Orchard,代码行数:36,代码来源:Shapes.cs

示例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'>&times;</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);
        }
开发者ID:DoctorSoft,项目名称:HospitalAPI,代码行数:36,代码来源:ModalWindowsHelper.cs

示例8: EditLink

        public override MvcHtmlString EditLink(HtmlHelper htmlHelper)
		{
			return htmlHelper.ActionLink<CmsController>(c => c.Edit(ContentId), "Edit");
		}
开发者ID:bertusmagnus,项目名称:Sutekishop,代码行数:4,代码来源:TextContent.cs

示例9: Link

 public override MvcHtmlString Link(HtmlHelper htmlHelper)
 {
     return htmlHelper.ActionLink(Name, Action, Controller);
 }
开发者ID:somlea-george,项目名称:sutekishop,代码行数:4,代码来源:ActionContent.cs

示例10: AccountRegisterLink

 public static MvcHtmlString AccountRegisterLink(HtmlHelper htmlHelper)
 {
     return htmlHelper.ActionLink("新しいユーザーとして登録する", AccountController.ActionNames.Register, ControllerNames.Account);
 }
开发者ID:kazuk,项目名称:AspNet452prod,代码行数:4,代码来源:ViewHelpers.cs

示例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();
        }
开发者ID:modulexcite,项目名称:framework-1,代码行数:25,代码来源:NavigationExtensions.cs


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