Ejemplo n.º 1
0
        /// <summary>
        /// Stores the view state of the specified <see cref="GridView"/>.
        /// </summary>
        /// <param name="view">The view to store view state for.</param>
        /// <returns></returns>
        public ViewStateToken StoreViewState(GridView view)
        {
            if (view == null)
            {
                throw new ArgumentNullException(nameof(view));
            }

            //Create a new ViewState.
            var viewState = ViewState.Create(this, view);

            //Store the state of the view.
            viewState.StoreState(view);
            //Add or update the ViewState for the GridView.
            if (!ViewStates.ContainsKey(view))
            {
                ViewStates.Add(view, viewState);
            }
            else
            {
                ViewStates[view] = viewState;
            }
            //Create a new StateToken for this GridControlState and GridView.
            var token = new ViewStateToken(this, view);

            return(token);
        }
Ejemplo n.º 2
0
 public void SaveExpandedMasterRows(GridView view)
 {
     if (view.GridControl.Views.Count == 1)
     {
         return;
     }
     SaveMasterRowsList.Clear();
     for (int i = 0; i < view.DataRowCount; i++)
     {
         if (view.GetMasterRowExpanded(i))
         {
             object key = view.GetRowCellValue(i, descriptor.keyFieldName);
             SaveMasterRowsList.Add(key);
             GridView detail = view.GetVisibleDetailView(i) as GridView;
             if (detail != null)
             {
                 ViewState state = ViewState.Create(this, detail);
                 if (state != null)
                 {
                     DetailViews.Add(key, state);
                     state.SaveState(detail);
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 public void SaveViewInfo(GridView view)
 {
     root = ViewState.Create(this, view);
     root.SaveState(view);
 }