开发者

How to display the values from one partial view control(Search) to a web grid partial view control?

In my view i have two partial views (Search,webgrid). When i click the update button in the search , the values fi开发者_如何学运维ltered are not binding in the webgrid ? How can i do this?


You could try something like this. Hope I understood your question correctly.

search partial:

 ...
 @using(Ajax.BeginForm("Search", new AjaxOptions(){UpdateTargetId = "SearchResults", 
 HttpMethod = "post" InsertionMode=InsertionMode.Replace})){
     <input id="searchString" type="text" value="Search for this ..." />
     <input type="submit" value="Search" />

 }
 ...

controller:

  [HttpPost]      
  public PartialViewResult Search(string searchString){
       IList<Results> results = _service.Search(searchString);
       return new PartialView("Webgrid", results)
  }

webgrid partial:

 @Model IList<Result>

 <div id="SearchResults">

 // Display Results

 </div>

Didn't compile the code. Hope it is almost compileable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜