0

C# と SQL Server 2005 を使用して ASP.Net MVC 3 アプリケーションを開発しています。コード ファーストのアプローチで Entity Framework を使用しています。

リンクに 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