0
$("#btntest").click(function() {
alert('Called btn test');
var FromDate = $("#FromDate").val();
var ToDate = $("#ToDate").val();
var UserId = $("#ddlUserName")[0].value;
debugger;
$.ajax({
url: '<%:Url.Action("Grid1","GridView") %>',
data: '{"uid":"' + UserId + '","fdate": "' + FromDate + '","tdate":"' + ToDate + '"}',
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
alert('Success');
alert(data);
window.open("../GridView/Grid1");
}
});
});
按鈕點擊GridView的行動有其相應的視圖(GRID1)
公衆的ActionResult GRID1(串UID,串FDATE,串tdate) 調用{
List<modeldata> list = new List<modeldata>();
DataTable ds1 = new DataTable();
SqlCommand cmd = new SqlCommand("spGettLeadReport", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@UserID", uid);
cmd.Parameters.Add("@FromDate", fdate);
cmd.Parameters.Add("@ToDate", tdate);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds1);
foreach (DataRow dr in ds1.Rows)
{
list.Add(new modeldata
{
LeadName = dr["LeadName"].ToString(),
CompanyName = dr["CompanyName"].ToString(),
CreatedOn = Convert.ToDateTime(dr["CreatedOn"]),
CreatedBy = dr["CreatedBy"].ToString(),
// ZoneName = dr["ZONE_NAME"].ToString()
});
}
return View(list);
}
觀點是不affecting.on它拋出一個錯誤新窗口..
我該如何更改爲相應的操作視圖? 請幫忙..