0

我正在使用 C# 和 SQL Server 2005 开发一个 ASP.Net MVC 3 应用程序。我正在使用具有代码优先方法的实体框架。

我想在链接上制作 jquery 效果。

我已经在一个按钮中有这种效果,我想在另一个也使用 Ajax 的按钮上重复它。

我尝试遵循它,但我没有得到任何结果。

我在描述动画的问题底部放了一段视频。

我创建了一个名为 AnouarController 的新控制器:

namespace MvcApplication2.Controllers
{
     [HandleError]
    public class AnouarController : Controller
    {   
    //
    // GET: /Anouar/

     public ActionResult Gestion()
     {
         return View();
     }
   }
}

这是我点击按钮时想要显示的视图 Gestion:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcApplication2.Models.FlowViewModel>" %>


<asp:Content ID="loginTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Gestion
</asp:Content>

<asp:Content ID="loginContent" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Gérer</h2>
    </asp:Content>

这是一个 GestionHelper 类,我按照另一个按钮的示例创建了它:

namespace Helpers
{
    public static class GestionHelper
    {
        public static string GestionLinkHelper(this HtmlHelper helper){
            string currentControllerName = (string)helper.ViewContext.RouteData.Values["controller"];
            string currentActionName = (string)helper.ViewContext.RouteData.Values["action"];

            var sb = new StringBuilder();

            sb.Append("<div id=\"gestionlink\">");

            sb.Append(helper.ActionLink("aaaaa", "Gestion", "Anouar"));
            sb.Append("</div>");
            return sb.ToString();
        }
    }
} 

最后,这是我在链接视图中添加的内容(允许该操作):

<%= Html.GestionLinkHelper() %>

这是一个描述 Jquery 动画的视频: 视频

4

0 回答 0