public void LoadAutoPopulatingData() { DataSet dsAutopopulate = new DataSet(); dsAutopopulate = PwPManager.GetPwPAutoPopulatingData(Convert.ToInt32(Session["PatientId"])); if (dsAutopopulate.Tables[0].Rows.Count > 0) { txtLMPDate.Value = dsAutopopulate.Tables[0].Rows[0].IsNull("LMPDate") ? "" : ((DateTime)dsAutopopulate.Tables[0].Rows[0]["LMPDate"]).ToString("dd-MMM-yyyy"); txtEDD.Text = dsAutopopulate.Tables[0].Rows[0].IsNull("EDD") ? "" : ((DateTime)dsAutopopulate.Tables[0].Rows[0]["EDD"]).ToString("dd-MMM-yyyy"); } }