Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > GridView > Virtual Mode Cell Update

Answered Virtual Mode Cell Update

Feed from this thread
  • Posted on Jan 23, 2012 (permalink)

    Hello,

    I am implementing virtual mode for WinForms RadGridView

    Everything working ok except one thing, in my virtual mode implementation user may required additional data from slow data source in such case the data will not be available when grid needs the cell value.
    In this case the cells displays a "Loading..." text until the data is retrieved from the slow source.

    The problem is how to tell the GridView to reread the cells values to update the cells with real content.

    I tried the MasterTemplate.Refresh but this cause the grid scroll returns to the top again and display the first item.

    Is there any method to call to force the grid to re-read the visisble cells values without reseting the scroll?

    I am using 2011 Q2 SP1


    Reply

  • Answer Julian Benkov Julian Benkov admin's avatar

    Posted on Jan 26, 2012 (permalink)

    Hi Heshman,

    You should call the Update method of GridTableElement to solve this issue. Consider the sample below:

    public partial class VirtualGridForm : Form
    {
        private Random random = new Random((int)DateTime.Now.Ticks);
     
        public VirtualGridForm()
        {
            InitializeComponent();
             
            radGridView.VirtualMode = true;
            radGridView.CellValueNeeded += new GridViewCellValueEventHandler(radGridView_CellValueNeeded);
            radGridView.RowCount = 1000;
            radGridView.ColumnCount = 10;
        }
     
        void radGridView_CellValueNeeded(object sender, GridViewCellValueEventArgs e)
        {
            e.Value = random.Next(1000);
        }
     
        private void button1_Click(object sender, EventArgs e)
        {
            radGridView.TableElement.Update(GridUINotifyAction.DataChanged);
        }
    }

    I hope this helps.

    Kind regards,
    Julian Benkov
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.
  • Posted on Jan 29, 2012 (permalink)

    thanks for your reply,

    I am implementing this solution:
    var visibleRows = gridStudy.TableElement.VisualRows.Select(r=>r.RowInfo).ToArray();
    gridStudy.TableElement.Update(GridUINotifyAction.DataChanged, visibleRows);

    It works but I don't know whether the extra code I add to update the visible rows only enhance performanfce or not?

    Reply

  • Answer Julian Benkov Julian Benkov admin's avatar

    Posted on Feb 1, 2012 (permalink)

    Hello Hesham,

    This additional logic is not needed in virtual mode. RadGridView is optimized for this behavior and CellValueNeeded event will be fired only for the visible cells on the screen.

    Kind regards,
    Julian Benkov
    the Telerik team

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > GridView > Virtual Mode Cell Update
Related resources for "Virtual Mode Cell Update"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]