2009-10-02 25 views
0

任何人都可以說爲什麼我在自定義助手中使用的方法BeginForm正在渲染這個文本在第一個文本框?幫助者使用ajax幫手BeginForm

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

使用 '<%' 不是在你開始表單標籤 '<%='