This is a migrated thread and some comments may be shown as answers.

Spineditor position changing when scrolling

3 Answers 62 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Es
Top achievements
Rank 1
Es asked on 04 Dec 2013, 04:11 PM
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.

3 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 09 Dec 2013, 01:36 PM
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 >>
0
Es
Top achievements
Rank 1
answered on 17 Dec 2013, 09:21 AM
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?
0
George
Telerik team
answered on 20 Dec 2013, 08:12 AM
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 >>
Tags
GridView
Asked by
Es
Top achievements
Rank 1
Answers by
George
Telerik team
Es
Top achievements
Rank 1
Share this question
or