I have to avoid page refresh. Every time I click the submit button, page is refreshed. How do I avoid that?
protected void Button1_Click(object sender, EventArgs e)
{
string firstname = DropDownList1.SelectedItem.Text;
if (firstname == "All")
{
da = new SqlDataAdapter(query, con);
}
dt = new DataTable();
dt = ds.DataTable1;
da.Fill(dt);
rdc.Load(Server.MapPath("CrystalReport.rpt"));
rdc.SetDataSource(ds);
CrystalReportViewer1.ReportSource = rdc;
CrystalReportViewer1.RefreshReport();
}
I would suggest putting everything that needs to be updated in an
<asp:UpdatePanel>.You can find that control in the Ajax Control Toolkit
You will also have to add a
<asp:ScriptManager>on top of your page.