I have to show the report of employee telephone numbers. So for this i gave two options:
1. All and 2. Employee wise.
In case 'Employee wise' radiobutton is clicked then one textbox will come where u will give employee id and all telephone numbers(residential cell / residential landline / personal cell / office number etc) of that particular employee will be displayed.
But in case the radiobutton 'All' is selected then all telephone numbers of all the employees will be displayed.
Here, i could do with both the things properly. For first time when i select the radiobutton of 'all' and click on show report it is displaying correct report giving telephone numbers of all the employees. Then when i select the radiobutton 'employee wise' and give the id of particular employee and click on button, then also particularly for that employee the report is displayed correctly.
but when i again come back to radiobutton 'all' after when once employee wise report is displayed, then in 'all' also same record is displayed and all records is not coming.
wat will be the reason for this? For your persual i m copy pasting the coding. Please get back to me with this at earliest.
protected void btnshow_Click(object sender, EventArgs e)
{
//rdbtcust is to show report customer wise
if (rdbtncust.Checked)
{
lblcustpk.Visible =
true;
txtcustname.Visible =
true;
btncustpk.Visible =
true;
string custid = Session["custid"].ToString();
Response.Write(custid);
tblreport.Visible =
true;
SqlDataAdapter dap = new SqlDataAdapter("select custid, fname, lname, restelno, mobileno, shopll, resmobno, others from tblcustgeneral where custid='" + custid + "'", con);
DataSet das = new DataSet();
dap.Fill(das);
ReportDocument rpt11 = new ReportDocument();
rpt11.Load(Server.MapPath(
"custwisetelno.rpt"));
rpt11.SetDataSource(das);
CrystalReportViewer1.SelectionFormula =
"{tblcustgeneral.custid}=" + custid + "";
CrystalReportViewer1.ReportSource = rpt11;
CrystalReportViewer1.DataBind();
btnprint.Visible =
true;
//custwisetotdeduction.rpt
}
//rdbtnall is to show report of all the customers
else if (rdbtnall.Checked)
{
SqlDataAdapter dap2 = new SqlDataAdapter("select custid, fname, lname, restelno, mobileno, shopll, resmobno, others from tblcustgeneral", con);
DataSet das2 = new DataSet();
dap2.Fill(das2);
ReportDocument rpt1 = new ReportDocument();
rpt1.Load(Server.MapPath(
"alltelno.rpt"));
rpt1.SetDataSource(das2);
tblreport.Visible =
true;
CrystalReportViewer1.ReportSource = rpt1;
CrystalReportViewer1.DataBind();
btnprint.Visible =
true;
}
}
protected void rdbtnall_CheckedChanged(object sender, EventArgs e)
{
Session[
"custid"] = null;
lblcustpk.Visible =
false;
txtcustname.Visible =
false;
btncustpk.Visible =
false;
txtcustname.Text =
"";
}
protected void rdbtncust_CheckedChanged(object sender, EventArgs e)
{
lblcustpk.Visible =
true;
txtcustname.Visible =
true;
btncustpk.Visible =
true;
}