[Message Deleted]
-
-
-
I am sorry for posting it here...I am deleting the post from here....and to my defense I would say that I thought this much code would be needed to see what I am trying to do here. Though it might seem to be a very unprofessional way to some of us.
-
Just info : 1. Do some debugging, and give us only the line, where exception/error is thrown. 2. If we see a lot of code, then we just skip it, sometimes we have no times to review all of your codes.
private void Page_Load(object sender, System.EventArgs e) { if (this.IsPostBack) { getMLNO(Specific_Query_DDL.SelectedItem.Value); //This is where I am generating all the values from the DB for the second dropdown list. And as it's getting post back so even if I click submit button then the page gets post back and the selected value for the second dropdown list gets set to the default value, which is ANY } } private void getMLNO(string selectedvalue) //This is the method where all the MLNOs are generated { if(selectedvalue=="ResistantL") { string sql= "SELECT re_MLNO, MAX(re_SpecimenDate)-MIN(re_SpecimenDate) AS DaysSeronegative FROM ml_hiv_status WHERE (re_HIV1_Status=0) GROUP BY re_MLNO"; OleDbConnection connection = new OleDbConnection(HIV.Database.DataConstants.CONNECTION_STRING); OleDbDataAdapter adapter = new OleDbDataAdapter(); OleDbCommand command = new OleDbCommand(sql, connection); DataSet ds = new DataSet(); adapter.SelectCommand = command; if (adapter.Fill(ds) > 0) { DataView view = ds.Tables[0].DefaultView; mlno_DDL.DataSource = view; mlno_DDL.DataValueField="re_MLNO"; mlno_DDL.DataTextField = "re_MLNO"; mlno_DDL.DataBind(); resultsLabel.Visible= true; mlno_DDL.Items.Insert(0, "ANY"); } connection.Close(); } } private void mlno_DDL_SelectedIndexChanged(object sender, System.EventArgs e) { } private void submitButton_Click(object sender, System.EventArgs e) //SubmitButton_Click method fetches all the data from the Database depending on the 2 values selected from the 2 dropdown list { if(Specific_Query_DDL.SelectedItem.Value=="ResistantL") { if(mlno_DDL.SelectedItem.Value=="ANY") //All the values from the Db are pulled if ANY is chosen from the second DDL { executeResistantListQuery_ANY(); } else if(mlno_DDL.SelectedItem.Value!="ANY") //Data are pulled if a specific MLNO is chosen from the DB, and this one is not
-
private void Page_Load(object sender, System.EventArgs e) { if (this.IsPostBack) { getMLNO(Specific_Query_DDL.SelectedItem.Value); //This is where I am generating all the values from the DB for the second dropdown list. And as it's getting post back so even if I click submit button then the page gets post back and the selected value for the second dropdown list gets set to the default value, which is ANY } } private void getMLNO(string selectedvalue) //This is the method where all the MLNOs are generated { if(selectedvalue=="ResistantL") { string sql= "SELECT re_MLNO, MAX(re_SpecimenDate)-MIN(re_SpecimenDate) AS DaysSeronegative FROM ml_hiv_status WHERE (re_HIV1_Status=0) GROUP BY re_MLNO"; OleDbConnection connection = new OleDbConnection(HIV.Database.DataConstants.CONNECTION_STRING); OleDbDataAdapter adapter = new OleDbDataAdapter(); OleDbCommand command = new OleDbCommand(sql, connection); DataSet ds = new DataSet(); adapter.SelectCommand = command; if (adapter.Fill(ds) > 0) { DataView view = ds.Tables[0].DefaultView; mlno_DDL.DataSource = view; mlno_DDL.DataValueField="re_MLNO"; mlno_DDL.DataTextField = "re_MLNO"; mlno_DDL.DataBind(); resultsLabel.Visible= true; mlno_DDL.Items.Insert(0, "ANY"); } connection.Close(); } } private void mlno_DDL_SelectedIndexChanged(object sender, System.EventArgs e) { } private void submitButton_Click(object sender, System.EventArgs e) //SubmitButton_Click method fetches all the data from the Database depending on the 2 values selected from the 2 dropdown list { if(Specific_Query_DDL.SelectedItem.Value=="ResistantL") { if(mlno_DDL.SelectedItem.Value=="ANY") //All the values from the Db are pulled if ANY is chosen from the second DDL { executeResistantListQuery_ANY(); } else if(mlno_DDL.SelectedItem.Value!="ANY") //Data are pulled if a specific MLNO is chosen from the DB, and this one is not
-
Please do not delete a message, it creates a mess and is against the rules. When you're satisfied or no longer interested, edit the message to indicate so in the subject line. :)
Luc Pattyn
:badger: :jig: :badger:
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
:jig: :badger: :jig:
-
private void Page_Load(object sender, System.EventArgs e) { if (this.IsPostBack) { getMLNO(Specific_Query_DDL.SelectedItem.Value); //This is where I am generating all the values from the DB for the second dropdown list. And as it's getting post back so even if I click submit button then the page gets post back and the selected value for the second dropdown list gets set to the default value, which is ANY } } private void getMLNO(string selectedvalue) //This is the method where all the MLNOs are generated { if(selectedvalue=="ResistantL") { string sql= "SELECT re_MLNO, MAX(re_SpecimenDate)-MIN(re_SpecimenDate) AS DaysSeronegative FROM ml_hiv_status WHERE (re_HIV1_Status=0) GROUP BY re_MLNO"; OleDbConnection connection = new OleDbConnection(HIV.Database.DataConstants.CONNECTION_STRING); OleDbDataAdapter adapter = new OleDbDataAdapter(); OleDbCommand command = new OleDbCommand(sql, connection); DataSet ds = new DataSet(); adapter.SelectCommand = command; if (adapter.Fill(ds) > 0) { DataView view = ds.Tables[0].DefaultView; mlno_DDL.DataSource = view; mlno_DDL.DataValueField="re_MLNO"; mlno_DDL.DataTextField = "re_MLNO"; mlno_DDL.DataBind(); resultsLabel.Visible= true; mlno_DDL.Items.Insert(0, "ANY"); } connection.Close(); } } private void mlno_DDL_SelectedIndexChanged(object sender, System.EventArgs e) { } private void submitButton_Click(object sender, System.EventArgs e) //SubmitButton_Click method fetches all the data from the Database depending on the 2 values selected from the 2 dropdown list { if(Specific_Query_DDL.SelectedItem.Value=="ResistantL") { if(mlno_DDL.SelectedItem.Value=="ANY") //All the values from the Db are pulled if ANY is chosen from the second DDL { executeResistantListQuery_ANY(); } else if(mlno_DDL.SelectedItem.Value!="ANY") //Data are pulled if a specific MLNO is chosen from the DB, and this one is not