代码之家  ›  专栏  ›  技术社区  ›  Fabio Milheiro

使用ajax Helper BeginForm的Helper

  •  0
  • Fabio Milheiro  · 技术社区  · 15 年前

    System.Web.Mvc.Html.MvcForm
    

    它也在工作!:) :(

    我使用的代码如下:

    // The helper signature
    public static string Pagination(this HtmlHelper helper, int currentPage, int totalPages, string orderBy, string orderDirection, string listArea)
    
    // Ajax helper declartion
    AjaxHelper ajaxHelper = new AjaxHelper(helper.ViewContext, helper.ViewDataContainer);
    
    // Form html generation
    sb.Append(
                ajaxHelper.BeginForm(
                    helper.ViewContext.RouteData.Values["action"].ToString(),
                    new AjaxOptions { UpdateTargetId = listArea, LoadingElementId = "loading" }
                )
                + helper.TextBox("page")
                + helper.Hidden("orderBy", orderBy)
                + helper.Hidden("orderDirection", orderDirection)
                + "<input type=\"submit\" value=\"" + Localization.GetText("Go") + "\" /></form>"
            );
    
    1 回复  |  直到 9 年前
        1
  •  1
  •   willemaster    15 年前

    在开始窗体标记中使用“<%”而不是“<%=”!