i wanted to update some records from gridview row.
So Amount and Percentage should be noneditable and rest all fields should be editable after clicking on edit linkbutton.How to do it? This is my code for updating.
protected void gvDetails_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
// TextBox txtam = (TextBox)gvDetails.FooterRow.FindControl("txtfamtt");
// TextBox txtper = (TextBox)gvDetails.FooterRow.FindControl("txtfpercentage");
TextBox txtconf = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtconfirm");
TextBox txtdiff = (TextBox)gvDetails.Rows[e.RowIndex].FindControl("txtdifference");
RadioButtonList rdott = (RadioButtonList)gvDetails.Rows[e.RowIndex].FindControl("rdottstatus");
RadioButtonList rdoconfirm = (RadioButtonList)gvDetails.Rows[e.RowIndex].FindControl("rdoConfirmation");
Int64 currInvoiceId = Convert.ToInt64(Request.QueryString["edit_invoice_id"]);
try
{
MySqlConnection connect;
string connectStr = ConfigurationManager.ConnectionStrings["ExpoCrmConnectionString"].ToString();
connect = new MySqlConnection(connectStr);
// string queryStr = "insert into payment_receipt_status(invoic_id,Amount,Percentage,TTStatus,confirmationstatus,confirmationamount,Differenceamount)values(?iid,?Amount,?Percentage,?TTStatus,?confirmationstatus,?confirmationamount,?Differenceamount)";
string queryStr="update payment_receipt_status set TTStatus=?TTStatus,confirmationstatus=?confirmationstatus,confirmationamount=?confirmationamount,Differenceamount=?Differenceamount where invoic_id=?iid");
connect.Open();
MySqlCommand command = new MySqlCommand(queryStr, connect);
command.Parameters.AddWithValue("?iid", currInvoiceId);
//command.Parameters.AddWithValue("?Amount", txtam.Text);
// command.Parameters.AddWithValue("?Percentage", txtper.Text);
command.Parameters.AddWithValue("?TTStatus", rdott.SelectedItem.Text);
command.Parameters.AddWithValue("?confirmationstatus", rdoconfirm.SelectedItem.Text);
command.Parameters.AddWithValue("?confirmationamount", txtconf.Text);
command.Parameters.AddWithValue("?Differenceamount", txtdiff.Text);
command.ExecuteNonQuery();
connect.Close();
FillVendorGrid();
//txtam.Text = "";
// txtper.Text = "";
txtconf.Text = "";
txtdiff.Text = "";
connect.Close();
}
catch (Exception ex)
{
}
}