Hi All,
I'm editng a grid inline using the ExtractValuesFromItem method as described in your documentation. However, when the update has finished the grid remains in edit mode. How can I end the edit mode in this instance? Here is my code:
protected void radgridNetCosts_UpdateCommand(object source, GridCommandEventArgs e)
{
GridEditableItem item = (GridEditableItem)e.Item;
int bookingTransactionID = int.Parse(item["BookingTransactionID"].Text);
Dictionary<string, string> dictionary = new Dictionary<string, string>();
radgridNetCosts.MasterTableView.ExtractValuesFromItem(dictionary, item);
UpdatedSupplierCostsItem(radgridNetCosts, dictionary["SupplierReference"], bookingTransactionID);
}
private void UpdatedSupplierCostsItem(RadGrid radGrid, string supplierReference, int bookingTransactionID)
{
// connection string
string cs = ConfigurationManager.ConnectionStrings["mcsQCConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(cs);
// SQL Command
SqlCommand command = new SqlCommand("UpdateSupplierCostsItem", conn);
// Specify Command Type
command.CommandType = CommandType.StoredProcedure;
//Setup and assign parameters if needed
command.Parameters.Add("@SupplierReference", SqlDbType.VarChar, 50).Value = supplierReference;
command.Parameters.Add("@BookingTransactionID", SqlDbType.Int).Value = bookingTransactionID;
try
{
conn.Open();
command.ExecuteNonQuery();
}
catch (Exception ex)
{
// handle exception
}
finally
{
if (conn.State != null)
{
conn.Close();
}
}
}
Thanks!
I'm editng a grid inline using the ExtractValuesFromItem method as described in your documentation. However, when the update has finished the grid remains in edit mode. How can I end the edit mode in this instance? Here is my code:
protected void radgridNetCosts_UpdateCommand(object source, GridCommandEventArgs e)
{
GridEditableItem item = (GridEditableItem)e.Item;
int bookingTransactionID = int.Parse(item["BookingTransactionID"].Text);
Dictionary<string, string> dictionary = new Dictionary<string, string>();
radgridNetCosts.MasterTableView.ExtractValuesFromItem(dictionary, item);
UpdatedSupplierCostsItem(radgridNetCosts, dictionary["SupplierReference"], bookingTransactionID);
}
private void UpdatedSupplierCostsItem(RadGrid radGrid, string supplierReference, int bookingTransactionID)
{
// connection string
string cs = ConfigurationManager.ConnectionStrings["mcsQCConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(cs);
// SQL Command
SqlCommand command = new SqlCommand("UpdateSupplierCostsItem", conn);
// Specify Command Type
command.CommandType = CommandType.StoredProcedure;
//Setup and assign parameters if needed
command.Parameters.Add("@SupplierReference", SqlDbType.VarChar, 50).Value = supplierReference;
command.Parameters.Add("@BookingTransactionID", SqlDbType.Int).Value = bookingTransactionID;
try
{
conn.Open();
command.ExecuteNonQuery();
}
catch (Exception ex)
{
// handle exception
}
finally
{
if (conn.State != null)
{
conn.Close();
}
}
}
Thanks!