protected void gvImages_RowUpdating(object sender, GridViewUpdateEventArgs e) { SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=D:\site\SamsungClassifieds\App_Data\Dorknozzle.mdf;Integrated Security=True;User Instance=True"); con.Open(); //DateTime date = DateTime.Now; //date = date.AddDays(30); //int userid = Convert.ToInt32(gvImages.DataKeys[e.RowIndex].Values["lbladid"].ToString()); Label lbladid = (Label)gvImages.Rows[e.RowIndex].FindControl("lbladid"); TextBox txttitle = (TextBox)gvImages.Rows[e.RowIndex].FindControl("txttitle"); TextBox txtdesc = (TextBox)gvImages.Rows[e.RowIndex].FindControl("txtdesc"); Label lblprice = (Label)gvImages.Rows[e.RowIndex].FindControl("lblprice"); TextBox txtprice = (TextBox)gvImages.Rows[e.RowIndex].FindControl("txtprice"); RadioButton rd1 = (RadioButton)gvImages.Rows[e.RowIndex].FindControl("rb30"); RadioButton rd2 = (RadioButton)gvImages.Rows[e.RowIndex].FindControl("rb60"); RadioButton rd3 = (RadioButton)gvImages.Rows[e.RowIndex].FindControl("rb90"); SqlCommand cmd = new SqlCommand("UPDATE AD_DETAIL SET AD_TITLE ='" + txttitle.Text + "',AD_DESC ='" + txtdesc.Text + "',AD_PRICE ='" + txtprice.Text + "'WHERE AD_ID = '" + lbladid.Text + "'", con); cmd.ExecuteNonQuery(); gvImages.EditIndex = -1; Binddata(); con.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)