protected void Button4_Click(object sender, EventArgs e) { int id = Convert.ToInt32(HiddenField1.Value); Promotions dpt = new Promotions(); dpt.empid = Int32.Parse(TextBox1.Text); dpt.pro_type = DropDownList1.SelectedValue; dpt.amount = double.Parse(TextBox2.Text); dpt.activedate = DateTime.Parse(TextBox9.Text); dpt.pro_active = DateTime.Parse(TextBox10.Text); dpt.id = id; dpt.Basic = double.Parse(TextBox3.Text); dpt.HouseRent = double.Parse(TextBox4.Text); dpt.Medicalmoney = double.Parse(TextBox5.Text); dpt.Convences = double.Parse(TextBox6.Text); dpt.taxes = double.Parse(TextBox7.Text); dpt.Gross_Salary = double.Parse(TextBox8.Text); PromotionAccess manager = new PromotionAccess(); if (manager.Update(dpt) > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ClientScript", "alert('Successfully Updated')", true); GridView1.DataBind(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "ClientScript", "alert('Update Fail')", true); } //int id = Int32.Parse(TextBox1.Text.ToString()); //Promotions lst = new PromotionAccess().Getpro(id); //TextBox2.Text=lst.amount.ToString(); //TextBox3.Text=lst.Basic.ToString(); //TextBox4.Text=lst.HouseRent.ToString(); //TextBox5.Text=lst.Medicalmoney.ToString(); //TextBox6.Text=lst.Convences.ToString(); //TextBox7.Text=lst.taxes.ToString(); //TextBox8.Text=lst.Gross_Salary.ToString(); //TextBox9.Text=lst.activedate.ToString(); //TextBox10.Text = lst.pro_active.ToString(); //DropDownList1.SelectedValue = lst.pro_type.ToString(); }