protected void btnUpdate_Click(object sender, EventArgs e) { lblEMsg.Visible = false; string[] Supp; Profile pro = new Profile(); try { if (lstid.SelectedItem.Text == "") { lblEMsg.Text = "Please select Supplier ID"; lblEMsg.Visible = true; } else { Supp = new string[15]; Supp[0] = lstid.Text; Supp[1] = txtSName.Text; Supp[2] = txtAdd.Text; Supp[3] = txtPhone.Text; Supp[4] = txtFax.Text; Supp[5] = txtEmail.Text; if (chkStatus.Checked == true) { Supp[6] = "A"; } else { Supp[6] = "I"; } bool status; status = pro.UpdateSupplier(Supp); if (status == false) { lblEMsg.Visible = true; lblEMsg.Text = "Supplier updation Failed"; } lblEMsg.Visible = true; lblEMsg.Text = "Supplier updated."; //Load all the Category First. string sql = "SELECT Supplier_ID FROM Supplier"; SqlDataReader sdr; sdr = pro.ReturnMDetails(sql); lstid.Items.Clear(); while (sdr.Read()) { lstid.Items.Add(sdr["Supplier_ID"].ToString().Trim()); } sdr.Close(); return; //txtCName.Text = ""; //txtcDesc.Text = ""; } } catch (Exception ex) { throw ex; } }