protected virtual void CreatePagerFields()
        {
            // In theory (on multi-core or SMP machines), OnTotalRowCountAvailable may
            // be called asynchronously to this method (since it is a delegate reacting
            // to event in the container), so we want to protect ourselves from data
            // corruption here. Lock would be an overkill, since we really want to
            // create the list only once anyway.
            _createPagerFieldsRunning = true;

            ControlCollection controls = Controls;

            controls.Clear();

            DataPagerFieldItem control;

            foreach (DataPagerField dpf in _fields)
            {
                control = new DataPagerFieldItem(dpf, this);
                controls.Add(control);
                if (dpf.Visible)
                {
                    dpf.CreateDataPagers(control, _startRowIndex, _maximumRows, _totalRowCount, _fields.IndexOf(dpf));
                    control.DataBind();
                }
            }

            _createPagerFieldsRunning = false;
        }
Esempio n. 2
0
 protected virtual void CreatePagerFields()
 {
     _creatingPagerFields = true;
     Controls.Clear();
     if (_fields != null)
     {
         foreach (DataPagerField field in _fields)
         {
             DataPagerFieldItem fieldItem = new DataPagerFieldItem(field, this);
             Controls.Add(fieldItem);
             if (field.Visible)
             {
                 field.CreateDataPagers(fieldItem, _startRowIndex, _maximumRows, _totalRowCount, _fields.IndexOf(field));
                 fieldItem.DataBind();
             }
         }
     }
     _creatingPagerFields = false;
 }