2013-05-12 25 views
0

我正在開發使用C#和SQL Server 2005jQuery的事件在ASP MVC 3 Web應用程序

我想創建一個按鈕一個jQuery事件一個ASP.Net MVC 3應用程序。這就像一個手風琴動畫。

我已經在模板中使用了一個示例,我想在另一個按鈕中重新制作它。

這是描述事件的video

對不起,我沒有發佈任何代碼,因爲我沒有真正發現這個事件的腳本在哪裏。

但是,我會編輯我的帖子的任何需求。

感謝您的諒解:)

這是我想證明,當我點擊按鈕的觀點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(); 
     } 
    } 
} 

我創造了一個名爲AnouarController新的控制器:

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

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

終於,,,這是我在鏈接的視圖中添加(允許的動作):

<%= Html.GestionLinkHelper() %> 
+0

你必須發佈一些代碼。至少要創建一個視圖和按鈕。甚至更好,如果你刺探找到你放置腳本標籤的地方。你越給予更好的幫助,你會得到 – 2013-05-12 18:45:12

+0

好吧只要繼續與我,我會張貼一些代碼,我嘗試做它 – anouar 2013-05-12 18:50:37

+0

@DaveA檢查我編輯請 – anouar 2013-05-12 18:54:33

回答

2

如果我理解你,添加一個按鈕,你的目標DIV

<input type="button" value="Show Gestion" id="btnShowGestion" /> 
<input type="button" value="Hide Gestion" id="btnHideGestion" /> 
<div id="divGestion"></div> 

添加您的JQuery就緒

<script type="text/javascript"> 

    $(document).ready(function() { 

    $('#divGestion').load('/Anouar/Gestion'); 

    $('#btnShowGestion').click(function() { $('#divGestion').show() }); 
    $('#btnHideGestion').click(function() { $('#divGestion').hide() }); 

    }); 

</script> 

不知道什麼你想阿賈克斯要執行的動作,我認爲ÿ你想將一個局部視圖加載到一個div中。

+0

不錯,,謝謝你的工作,,,, ,但動畫是不是像在視頻(最大的擴展或放大,,,,它只是一個出現:(當我再次點擊按鈕,,,它停留。 PS:你的代碼包含2錯誤:腳本必須在小寫字母和輸入需要一個'/'來關閉 – anouar 2013-05-12 21:15:39

+0

@anouar,是的,我對這個標記很sl。,我只是想證明一點,我可以理解你沒有得到正確的影響 - 我還是不知道你需要什麼影響,我給了你一個'創造影響',而不是一個動畫的影響,我更好地解釋你的動畫應該如何造成,我可以進一步幫助... – 2013-05-12 21:18:40

+0

謝謝,,,你看視頻?? – anouar 2013-05-12 21:21:51