private void StepSortProcessGrid() { FmViewTDS dataSet = new FmViewTDS(); dataSet.LFS_FM_TYPE_VIEW_SORT.Merge(fmTypeViewSort, true); FmTypeViewSort model = new FmTypeViewSort(dataSet); // Update rows if (Session["fmTypeViewSortDummy"] == null) { foreach (GridViewRow row in grdSort.Rows) { int sortId = int.Parse(grdSort.DataKeys[row.RowIndex].Values["SortID"].ToString()); bool selected = ((CheckBox)row.FindControl("cbxSelected")).Checked; int order = 0; try { order = int.Parse(((DropDownList)row.FindControl("ddlOrder")).SelectedValue); } catch { order = 0; } model.Update(hdfFmType.Value, int.Parse(hdfCompanyId.Value), sortId, order, selected); } model.Table.AcceptChanges(); fmTypeViewSort = (FmViewTDS.LFS_FM_TYPE_VIEW_SORTDataTable)model.Table; Session["fmTypeViewSort"] = fmTypeViewSort; } }