I would appreciate if anyone could help me here:
I had two dropdowns and added the third one (Category) in a C# report page, how to get the data of all dropdowns from sql server.
1st dropdown: ddlReportType 2nd dropdown: ddlGroup 3rd dropdown: ddlcategory
below is my code:
public void Reportquery()
{
switch (this.ddlReportType.SelectedValue)
{
case "1":
//successfully Loaded
switch (ddlGroup.SelectedValue)
{
case "All":
Session["Select_Query"] = "Select ID, CONVERT(CHAR(10), SCAN_DATE, 111) SCAN_DATE,Substring(SUBSCRIBER,1,20) DEALER_ID," + " MSISDN,FILE_PATH,USERNAME, Category, 'File Uploaded' Report_Criteria from UPLOAD where scan_date between'" + cldrFrom.SelectedValue + "' and '" + cldrTo.SelectedValue + "'";
Session["Count_Query"] = "Select Count(*) as Cnt from UPLOAD" + " where scan_date between'" + cldrFrom.SelectedValue + "' and '" + cldrTo.SelectedValue + "'";
break;
default:
Session["Select_Query"] = "Select ID, CONVERT(CHAR(10), SCAN_DATE, 111) SCAN_DATE,Substring(SUBSCRIBER,1,20) DEALER_ID," + " MSISDN,FILE_PATH,USERNAME,Category, 'File Uploaded' Report_Criteria from UPLOAD " + " where scan_date between'" + cldrFrom.SelectedValue + "' and '" + cldrTo.SelectedValue + "' and rtrim(ltrim(Subscriber)) ='" + ddlGroup.SelectedItem.Text.Trim() + "'";
Session["Count_Query"] = "Select Count(*) as Cnt from UPLOAD" + " where scan_date between'" + cldrFrom.SelectedValue + "' and '" + cldrTo.SelectedValue + "' and rtrim(ltrim(Subscriber)) ='" + ddlGroup.SelectedItem.Text.Trim() + "'";
break;
}
break;
case "2":
//Failed to laod
switch (ddlGroup.SelectedValue)
{
case "All":
Session["Select_Query"] = "Select Value as ID, CONVERT(CHAR(10), SCAN_DATE, 111) SCAN_DATE, SUBSCRIBER as Dealer_ID, " + " FileName as MSISDN,File_Path, username, Category, 'File Rejected' as Report_Criteria from CRI_Rejected a, code_rejected b " + " where a.Rejection_Code=b.id and scan_date between'" + cldrFrom.SelectedValue + "' and '" + cldrTo.SelectedValue + "'";
Session["Count_Query"] = "Select count(a.ID) as cnt from CRI_Rejected a, code_rejected b " + " where a.Rejection_Code=b.id and scan_date between'" + cldrFrom.SelectedValue + "' and '" + cldrTo.SelectedValue + "'";
break;
default:
Session["Select_Query"] = "Select Value as ID, CONVERT(CHAR(10), SCAN_DATE, 111) SCAN_DATE, SUBSCRIBER as Dealer_ID, " + " FileName as MSISDN,File_Path, username, Category, 'File Rejected' as Report_Criteria from CRI_Rejected a, code_rejected b " + " where a.Rejection_Code=b.id and scan_date between'" + cldrFrom.SelectedValue + "' and '" + cldrTo.SelectedValue + "'" + " and rtrim(ltrim(Subscriber)) ='" + ddlGroup.SelectedItem.Text.Trim() + "'";
Session["Count_Query"] = "select count(*) as cnt from CRI_Rejected where scan_date between'" + cldrFrom.SelectedValue + "' and '" + cldrTo.SelectedValue + "'" + " and rtrim(ltrim(Subscriber)) ='" + ddlGroup.SelectedItem.Text.Trim() + "'";
break;
}
break;
}
}