Spineditor position changing when scrolling

4 posts, 0 answers
  1. Es
    Es avatar
    2 posts
    Member since:
    Sep 2013

    Posted 04 Dec 2013 Link to this post

    Hi,
    I have some problem with RadSpinEditor in GridView. When I'm scrolling GrdView, spineditor changing position
    Code:
    private IList<Attribute> _data = new List<Attribute>();
    private void bwLoadData_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
            {
                this.grvAttribute1.DataSource = _data;
                this.grvAttribute1.CellFormatting += insertControls;
            }
    Attribute attribute = new Attribute();
     private void insertControls(object sender, CellFormattingEventArgs e)
            {
                try
                {
                    if (e.Column.Name == "Type")
                    {
                        if (attribute.Type == 3)
                        {
                            if (e.CellElement.Children.Count == 0)
                            {
     
                                RadSpinEditor se = new RadSpinEditor();
                                se.Dock = DockStyle.Fill;
                                se.ShowUpDownButtons = false;
                                se.ThemeName = "TelerikMetro";
                                se.TextAlignment = HorizontalAlignment.Center;
                                se.DecimalPlaces = 2;
                                se.Minimum = -999999.99M;
                                se.Maximum = 999999.99M;
                                Telerik.WinControls.RadHostItem i = new Telerik.WinControls.RadHostItem(se);
                                e.CellElement.Children.Add(i);                           
                            }
     
                        }
                         
                    }
                }
                catch (Exception ex)
                {
          //message
                }
            }
    It's bug in my code or in control implementation?
    Please help me.
  2. George
    Admin
    George avatar
    500 posts

    Posted 09 Dec 2013 Link to this post

    Hi Sylwester,

    Thank you for contacting Telerik Support.

    Due to the UI virtualization it is not recommended to add/remove an editor on the CellFormatting event. You can read more about the editors in RadGridView on the following url - http://www.telerik.com/help/winforms/gridview-editors.html. You can also take a look at the article regarding Customizing editor behavior and others which you may find helpful.

    Let me know if you meet any further difficulties.

    Regards,
    George
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. Es
    Es avatar
    2 posts
    Member since:
    Sep 2013

    Posted 17 Dec 2013 Link to this post

    Thanks for replay.
    I have one more problem. Finish effect added controls to GridView is view on attach image - grvstyle.png. Hierarchy on my GridView like this:
    Name   Type
    a1          SpinEditor or TextBox
    a2          DropDownList
    a3          SpinEditor or TextBox

    If I have three gridview
    First: Decimal values
    Two: List values
    ThreeL List values
    Is not problem, I can insert column GridTextBoxColumn or GridViewComboBoxColumn (for list values) to specific gridview but how can I do insert two types controls/editors to one column in one gridview?
  4. George
    Admin
    George avatar
    500 posts

    Posted 20 Dec 2013 Link to this post

    Hi Sylwester,

    Thank you for your reply.

    In this case you can set the editor dynamically depending on your requirements. For example you can use the EditorRequired to set the type of the editor you want to be initialized. Then on the CellEditorInitialized you can customize that editor. You can read more about custom editors on the following article: http://www.telerik.com/help/winforms/gridview-editors-using-custom-editors.html, however you do not necessarily need to create a custom editor.

    I hope this helps.

    Regards,
    George
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top