public void FetchAndBind(Int32 _estNum, Int32 twc_project_number) { DataSet dsInstallers; Whitfield_Project _wc = new Whitfield_Project(); whitfield_reports _wr = new whitfield_reports(); bindcontrols(_estNum,twc_project_number); IDataReader iReader = _wc.GetProjectInfo(_estNum, twc_project_number); // ' Loop through the DataReader and write out each entry while (iReader.Read()) { txttwcPrjNumber.Text = twc_project_number.ToString().Trim(); txtrealPrjNumber.Text = iReader["Real_proj_Number"] == DBNull.Value ? "" : iReader["Real_proj_Number"].ToString(); txtClientPrjNumber.Text = iReader["client_proj_number"] == DBNull.Value ? "" : iReader["client_proj_number"].ToString(); txtContractNumber.Text = iReader["contract_number"] == DBNull.Value ? "" : iReader["contract_number"].ToString(); txtprjname.Text = iReader["ProjName"] == DBNull.Value ? "" : iReader["ProjName"].ToString(); lblPrjHeader.Text = iReader["ProjName"] == DBNull.Value ? "" : iReader["ProjName"].ToString(); txtfinalbid.Text = iReader["FinalPrice"] == DBNull.Value ? "" : iReader["FinalPrice"].ToString(); txtdesc.Text = iReader["ProjDescr"] == DBNull.Value ? "" : iReader["ProjDescr"].ToString(); txtNotes.Text = iReader["Notes"] == DBNull.Value ? "" : iReader["Notes"].ToString(); txtConstStdate.Text = iReader["ConstrStart"] == DBNull.Value ? "" : iReader["ConstrStart"].ToString(); txtConstDuration.Text = iReader["ConstrDur"] == DBNull.Value ? "" : iReader["ConstrDur"].ToString(); txtConstEndDate.Text = iReader["ConstrCompl"] == DBNull.Value ? "" : iReader["ConstrCompl"].ToString(); txtOverheadCost.Text = iReader["OverheadCost"] == DBNull.Value ? "" : iReader["OverheadCost"].ToString(); txtMatContCost.Text = iReader["MatContCost"] == DBNull.Value ? "" : iReader["MatContCost"].ToString(); //txtCurrentContract.Text = iReader["C_Contract_Value"] == DBNull.Value ? "" : iReader["C_Contract_Value"].ToString(); txtOrigContract.Text = iReader["O_Contract_Value"] == DBNull.Value ? "0" : iReader["O_Contract_Value"].ToString(); txtChangeOrder.Text = iReader["Change_Order_Value"] == DBNull.Value ? "0" : iReader["Change_Order_Value"].ToString(); lblCurrentContract.Text = (Convert.ToDecimal(txtOrigContract.Text) + Convert.ToDecimal(txtChangeOrder.Text)).ToString(); //Construction_Start_Date = iReader["ConstrStart"] == DBNull.Value ? "" : iReader["ConstrStart"].ToString(); //Construction_End_Date = iReader["ConstrCompl"] == DBNull.Value ? "" : iReader["ConstrCompl"].ToString(); ViewState["Construction_Start_Date"] = iReader["ConstrStart"] == DBNull.Value ? "" : iReader["ConstrStart"].ToString(); ViewState["Construction_End_Date"] = iReader["ConstrCompl"] == DBNull.Value ? "" : iReader["ConstrCompl"].ToString(); String wincompe = iReader["WinMill"] == DBNull.Value ? "" : iReader["WinMill"].ToString(); String winclient = iReader["WinClient"] == DBNull.Value ? "" : iReader["WinClient"].ToString(); String prjType = iReader["ProjType"] == DBNull.Value ? "" : iReader["ProjType"].ToString(); ; String prjArch = iReader["Architect"] == DBNull.Value ? "" : iReader["Architect"].ToString(); String Status = iReader["Status"] == DBNull.Value ? "" : iReader["Status"].ToString(); ddlwonclient.SelectedIndex = ddlwonclient.Items.IndexOf(ddlwonclient.Items.FindByValue(winclient.ToString())); ddlprjtype.SelectedIndex = ddlprjtype.Items.IndexOf(ddlprjtype.Items.FindByValue(prjType.ToString())); ddlarchitect.SelectedIndex = ddlarchitect.Items.IndexOf(ddlarchitect.Items.FindByValue(prjArch.ToString())); ddlPrjStatus.SelectedIndex = ddlPrjStatus.Items.IndexOf(ddlPrjStatus.Items.FindByValue(Status.ToString())); dsInstallers = _wc.SelectInstallers(twc_project_number); if (dsInstallers.Tables[0].Rows.Count > 0) { foreach (DataRow dRow in dsInstallers.Tables[0].Rows) { String _cntlVal = dRow["Userid"].ToString(); ListItem currentCheckBox = chkInstallers.Items.FindByValue(_cntlVal.ToString().Trim()); if (currentCheckBox != null) { currentCheckBox.Selected = true; } } } } }