private void grdRules_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { // Get the item to be updated this.grdRules.EditItemIndex = e.Item.ItemIndex; // Get the selected DDL value string newVal = ((DropDownList)e.Item.FindControl("ddlRuleType")).SelectedValue; // Retrieve the previous Order Detail DataSet this.__dsSiteRules = (DataSet)Session["dsSiteRules"]; //Update the DataSet with the selected DDL Value this.__dsSiteRules.Tables[0].Rows[e.Item.DataSetIndex]["RuleType"] = newVal; // Save the DataSet (the DataGrid automatically binds back) this.Save(this.oSiteRules, this.__dsSiteRules); // Push the updated DS back into the Session Variable Session["dsSiteRules"] = this.__dsSiteRules; // Reset the edited item and rebind the DataGrid this.grdRules.EditItemIndex = -1; this.BindControl(this.grdRules); }