public void BindData() { List <TrainerDetails> trainerDetailsList = new List <TrainerDetails>(); model.TrainerDetails trainerdao = new model.TrainerDetails(); MoreDetails moredetails = new MoreDetailsSqlImpl(); trainerdao = moredetails.getTrainerDetails(long.Parse(Request.QueryString["trainerId"])); TextBox1.Text = trainerdao.TrainerId.ToString(); TextBox2.Text = trainerdao.First_name; TextBox3.Text = trainerdao.Last_name; TextBox4.Text = trainerdao.Gender; TextBox5.Text = trainerdao.Age.ToString(); TextBox6.Text = trainerdao.Contact_no.ToString(); TextBox7.Text = trainerdao.EmailId; TextBox11.Text = trainerdao.Description; TextBox9.Text = trainerdao.StartDate.ToString(); TextBox10.Text = trainerdao.EndDate.ToString(); TextBox8.Text = trainerdao.Availability.ToString(); TrainerDao train = new TrainerDaoSqlImpl(); List <Trainer> trainer = new List <Trainer>(); long tid = 0; tid = long.Parse(Request.QueryString["trainerId"]); List <Skill> skillList = new List <Skill>(); skillList = train.getTrainerSkillList(tid); if (skillList.Count == 0) { DropDownList1.Items.Add("No Skills"); } else { DropDownList1.DataSource = skillList; DropDownList1.DataTextField = "SkillName"; DropDownList1.DataValueField = "SkillId"; DropDownList1.DataBind(); } }
public long trainerdet(string userid) { model.TrainerDetails details = new model.TrainerDetails(); SqlConnection connect = ConnectionHandler.getConnection(); connect.Open(); SqlCommand cmd = new SqlCommand("select * from trainer where userid=@userid", connect); cmd.Parameters.AddWithValue("@userid", userid); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); connect.Close(); DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { details.TrainerId = long.Parse(dr["trainerId"].ToString()); } long h = details.TrainerId; return(h); }