ASPX page button click not fire

Oct 23 2015 7:34 AM
I develop MVC project and I add report using aspx page and it view in Razor page (@Html.Partial("ReportViwerASPX"))
 
when i view report page load code excute but button click not working, please Help
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" AutoEventWireup="true" %>
<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<!DOCTYPE html>
<html>
<head runat="server">
<meta name="viewport" content="width=device-width" />
<title>ReportViwer In Multi Location Sales Report</title>
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
if (!IsPostBack)
{
List<ERPReporting.sp_MultiLocation_SalesReport_Result> MulLocSales = null;
using (ERPReporting.MultiLocaSalesEntities db = new ERPReporting.MultiLocaSalesEntities())
{
ddlLocations.DataSource = db.sp_getBranchers();
ddlLocations.DataBind();
MulLocSales = db.Database.SqlQuery<ERPReporting.sp_MultiLocation_SalesReport_Result>("sp_MultiLocation_SalesReport @LocationID, @FromDate, @ToDate",
new System.Data.SqlClient.SqlParameter("@LocationID", ddlLocations.SelectedValue),
new System.Data.SqlClient.SqlParameter("@FromDate", DateTime.Now),
new System.Data.SqlClient.SqlParameter("@ToDate", DateTime.Now)).ToList();
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/MultiLocSales.rdlc");
ReportViewer1.LocalReport.DataSources.Clear();
ReportDataSource rds = new ReportDataSource("MultiLoctSales", MulLocSales);
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
List<ERPReporting.sp_MultiLocation_SalesReport_Result> MulLocSales = null;
using (ERPReporting.MultiLocaSalesEntities db = new ERPReporting.MultiLocaSalesEntities())
{
MulLocSales = db.Database.SqlQuery<ERPReporting.sp_MultiLocation_SalesReport_Result>("sp_MultiLocation_SalesReport @LocationID, @FromDate, @ToDate",
new System.Data.SqlClient.SqlParameter("@LocationID", ddlLocations.SelectedValue),
new System.Data.SqlClient.SqlParameter("@FromDate", DateTime.Now),
new System.Data.SqlClient.SqlParameter("@ToDate", DateTime.Now)).ToList();
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/MultiLocSales.rdlc");
ReportViewer1.LocalReport.DataSources.Clear();
ReportDataSource rds = new ReportDataSource("MultiLoctSales", MulLocSales);
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div>
<div>
<asp:Label ID="lblLocation" runat="server" Text="Location"></asp:Label>
<asp:DropDownList ID="ddlLocations" runat="server" DataTextField="Location" DataValueField="LocationID" AutoPostBack="false" AppendDataBoundItems="true">
<asp:ListItem Value="">--All--</asp:ListItem>
</asp:DropDownList>
</div>
<div>
<asp:Label ID="lblFrom" runat="server" Text="From Date"></asp:Label>
<asp:Calendar ID="CalFrom" runat="server"></asp:Calendar>
</div>
<div>
<asp:Label ID="lblTo" runat="server" Text="To Date"></asp:Label>
<asp:Calendar ID="CalTo" runat="server"></asp:Calendar>
</div>
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</div>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" AsyncRendering="false" SizeToReportContent="true">
</rsweb:ReportViewer>
</div>
</form>
</body>
</html>