Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

how to call controller action on ajax success with returned data from first call?

$
0
0

Hi to All,

I would have something like this

public ActionResult Search(int reportId)
{
/*code*/ PartialView(); }
public DataTable GetResult(int reportId, List<Domain.Entities.Filter> filter, string[] value) //i would try with (Dictionary<int, Tuple<Filter, string>>)
{
/*code*/
return dataTableVariable
}
public ActionResult SearchResult(DataTable dt)
{
    PartialView(dt);
}
Search.cshtml

@model List<Domain.Entities.Filter>
<div  class="page-title-box" style="overflowhidden">    
<div id="pnlFilter">    
@foreach (var item in Model)     
{         
<div class="col-md-4">            
<div class="form-group">                
<label for="@item.DbName.Substring(1)">@item.Name</label>                
<id="@item.DbName.Substring(1)" type="text" class="form-control">            
</div>        
</div>    
}     
</div>   
 <div class="col-md-12">        
<button style="margin-top5px" data-id="@ViewBag.reportId" id="btnSearch" title="Search" class="btn pull-right btn-sm btn-primary waves-effect waves-light">Search</button>    
</div></div><div class="content">    
<div class="container">        
<div id="searchResult" class="row">       
 </div>    
</div>
</div>
  1. so onclik on #btnSearch i would call GetResult, so this function has two parameters one i will take fr
  2. om data tag from the button (reportId), so my question is how to fill filter instance which is a list? also how to send array which i get on this way
    $("#btnSearch").click(function () {
    
        var paramArray = [];
        var item;
    
        $("#pnlFilter :input").each(function(e) {
            item = this.id + "=" + this.value;
            paramArray.push(item);
        });
    
    });

    sss

  3. so after executing this call I would like to call another action (SearchResult) with returned value from the function before and this should do this
$.get(url, function (data) {$("#searchResult").html(data);
    });

i have basic knowledge so please for help. Thanks 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>