dhivya pm

dhivya pm

  • NA
  • 10
  • 19k

how to set accept in cell(2) after selecting in gridview

Apr 2 2013 2:01 AM
i have to set status as accept,reject for customer,while registering status while be pending. i need ,if condition for this, which row is selected then corressponding event should change in database as accept or reject

protected void Button2_Click(object sender, EventArgs e) {

        SqlCommand cmd = new SqlCommand("select * from Testing", OIMS_01);
    SqlDataAdapter ad = new SqlDataAdapter(cmd);
     DataSet ds = new DataSet();

   ad.Fill(ds);

    if (GridView1.SelectedRow != null)
    {
     ds.Tables(0).Rows(0).Item(0) = GridView1.SelectedRow.Cells(1).Text;
      ds.Tables(0).Rows(0).Item(1) = GridView1.SelectedRow.Cells(2).Text;
ds.Tables(0).Rows(0).Item(2) = "Accept";

    }
    else
    {
        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please select a row.')", true);
    }
    ad.Update(ds);
}

Answers (1)