Telerik Forums
UI for WinForms Forum
27 answers
506 views

Hi!

                I have to use custom cell to display data but I have problem with performance.

                I have 500 rows and when I use my custom cell scrolling is very slow, not fluent.

I made simple test and checked that even if I add only one child control to custom cell, scrolling performance goes down significantly.

Is there any way to improve performance in this kind of scenario?

                This is my source code:

 

 

public class CustomCell : GridDataCellElement
{
    private RadCheckBoxElement _chk;
    public CustomCell(GridViewColumn column, GridRowElement row) : base(column, row)
    {
    }
    protected override void CreateChildElements()
    {
        base.CreateChildElements();
        _chk = new RadCheckBoxElement();
        _chk.Margin = new Padding(2, 2, 2, 2);
        _chk.MinSize = new Size(20, 20);
        _chk.Text = string.Empty;
        _chk.ToggleState = ToggleState.Off;
        this.Children.Add(_chk);
    }
    protected override Type ThemeEffectiveType
    { get { return typeof(GridDataCellElement); } }
}

namespace PerformanceIssue
{
    public partial class Form1 : Form
    {
        List<MySample> _list;
        public Form1()
        {
            InitializeComponent();
            _list = this.GenerateList();
        }
  
        private void btnPopulateUnbound_Click(object sender, EventArgs e)
        {
            GridViewDataColumn col = null;
            GridViewRowInfo row = null;
  
            for (int index = 1; index <= 10; index++)
            {
                col = new CustomColumn();
                radGridViewUnbound.Columns.Add(col);
                col.Width = 100;
            }
  
            foreach (MySample item in _list)
            {
                row = radGridViewUnbound.Rows.AddNew();
                row.Cells[0].Value = item.Property1;
                row.Cells[1].Value = item.Property2;
                row.Cells[2].Value = item.Property3;
                row.Cells[3].Value = item.Property4;
                row.Cells[4].Value = item.Property5;
                row.Cells[5].Value = item.Property6;
                row.Cells[6].Value = item.Property7;
                row.Cells[7].Value = item.Property8;
                row.Cells[8].Value = item.Property9;
                row.Cells[9].Value = item.Property10;
            }
            radGridViewUnbound.MultiSelect = true;
        }
  
        private List<MySample> GenerateList()
        {
            List<MySample> list = new List<MySample>();
            MySample item = null;
            for (int index = 0; index < 500; index++)
            {
                item = new MySample()
                {
                    Property1 = string.Format("Row: {0}, Col: {1}", index, 1),
                    Property2 = string.Format("Row: {0}, Col: {1}", index, 2),
                    Property3 = string.Format("Row: {0}, Col: {1}", index, 3),
                    Property4 = string.Format("Row: {0}, Col: {1}", index, 4),
                    Property5 = string.Format("Row: {0}, Col: {1}", index, 5),
                    Property6 = string.Format("Row: {0}, Col: {1}", index, 6),
                    Property7 = string.Format("Row: {0}, Col: {1}", index, 7),
                    Property8 = string.Format("Row: {0}, Col: {1}", index, 8),
                    Property9 = string.Format("Row: {0}, Col: {1}", index, 9),
                    Property10 = string.Format("Row: {0}, Col: {1}", index, 10)
                };
                list.Add(item);
            }
  
            return list;
        }
    }
}

 

               

Regards

Alexander
Telerik team
 answered on 18 Nov 2010
15 answers
305 views
I use RadGridView ver 8.2.0.0 (2008 Q3) with VB.NET 2010 and i need set the focus in a filter box for a column. How i make this?

Sorry for my english, i'm spanish
Andrew Shyliuk
Top achievements
Rank 1
 answered on 18 Nov 2010
3 answers
266 views
Hi,

I have a WinForms application that works in 2 modes : Consultation and Modification. When my form is in Consultation mode, I need to set the Enabled property of the MultiColumn ComboBox to false. However, the look of the ComboBox must be the same (White Back COlor with Black text color).

The problem is when I set the property enabled to false, I can't change the properties. The control always has grayish colors (text and border).

How can I set the proper colors to my disabled MultiColumn Combo box?

Thanks in advance

Yves Thibodeau
Stefan
Telerik team
 answered on 18 Nov 2010
1 answer
155 views
I know theming slows down the initialization so is there a way I can disable theming for the entire application?

Thanks

Ivan Petrov
Telerik team
 answered on 18 Nov 2010
3 answers
220 views
I have added a rad ribbon bar  form and set the isMDIContainter to true. But we i create the child form it loads in memory but does not display in the mdi form. Please guide me how it will. I searched over internet and no help is available.
I shall be very thankful to all members.


Shahzad Ahmed Khan
MIS COORDINATOR
Shahzad Ahmed
Top achievements
Rank 1
 answered on 18 Nov 2010
1 answer
136 views
Hi All,

In our WinForms application we have some hierarchival gridviews (we call them master-detail grid). This week we upgraded to the new 2010.3 10.1109 version, the last version was the 2010.2 10.914, and the application worked fine with the older verion.

But, now:
In the UserAddedRow event the e.Row.Hierarchilevel is 1 always, and not 0 in the case of new master rows.

In the UserDeletedRow event the e.Row.DataBoundItem is null, so, e.g.: e.Row.DataBoundItem.GetType().Name throws a NullReferenceException.

Any idea?


Best regards,

Peter Szintai
Richard Slade
Top achievements
Rank 2
 answered on 17 Nov 2010
13 answers
363 views
I have a situation where I want to create a treeview that has 4 levels.  I want to immediately load the first two levels, and only load levels 3 and 4 for a particular level 2 node when it is expanded.  I would like all of these nodes to be bound to a datatable(s) for ease of updating the data.  What would be the best way to accomplish this?  I am experimenting with both related tables in a hierarchy, and a self-referencing table, but haven't seen the exact results I am looking for.  Thanks for your help!
Sonya L
Top achievements
Rank 1
 answered on 17 Nov 2010
4 answers
268 views
Hello,

I just wanted to share this in case anyone else had the same issue.

Scenario
+ RadGridView bound to datasource.
+ Multiselect enabled

Pre Q3 2010 you were able to loop over the rows and set each SelectedRow IsVisible property to False as below
Private Sub RadButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButton1.Click
    Try
        Me.Cursor = Cursors.WaitCursor
        For Each row As GridViewRowInfo In Me.RadGridView1.SelectedRows
            row.IsVisible = False
        Next
    Finally
        Me.Cursor = Cursors.Default
    End Try
End Sub

Post Q3, you can only do this if you have only 1 row selected. With multiple rows selected the RadGridView throws an InvalidOperationException (collection was modified) exception.

In order to get over this, one needs to use the BeginUpdate / EndUpdate methods of RadGridView.

The modified code is below:

Private Sub RadButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadButton1.Click
    Try
        Me.Cursor = Cursors.WaitCursor
        Me.RadGridView1.BeginUpdate()
 
        For Each row As GridViewRowInfo In Me.RadGridView1.SelectedRows
            row.IsVisible = False
        Next
        Me.RadGridView1.EndUpdate(True)
    Finally
        Me.Cursor = Cursors.Default
    End Try
End Sub


hope someone finds this useful.

Richard

EDIT: Changed the BeginUpdate and EndUpdate to outside of the loop
Stefan
Telerik team
 answered on 17 Nov 2010
6 answers
180 views

Hello!


I have an issue with assigning the ImageIndex of GridCellElement.


Let’s take a simple code sample. An image list with a single image is assigned to the grid view. All settings are by default.


01.public partial class Form1 : Form
02.{
03.    public Form1()
04.    {
05.        InitializeComponent();
06. 
07.        for (int i = 0; i < 8; i++)
08.            radGridView1.Columns.Add(new GridViewTextBoxColumn());
09. 
10.        for (int i = 0; i < 8; i++)
11.            radGridView1.Rows.Add(radGridView1.Rows.NewRow());
12.    }
13. 
14.    private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
15.    {
16.        if ((e.CellElement.RowIndex + e.CellElement.ColumnIndex) % 2 == 0)
17.        {
18.            e.CellElement.ImageIndex = 0;
19.        }
20.    }
21.}

When I build this sample with “RadControls for WinForms Q3 2009 SP1” it shows the “chessboard”. But when I build it with the latest “RadControls for WinForms Q2 2010 SP2” it shows an empty grid.


To have it running as expected I have to do the following workaround (see line 5):


1.private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
2.{
3.    if ((e.CellElement.RowIndex + e.CellElement.ColumnIndex) % 2 == 0)
4.    {
5.        e.CellElement.ImageIndex = -1;
6.        e.CellElement.ImageIndex = 0;
7.    }
8.}

So, perhaps this is a bug.


Thank you.

Alexander
Telerik team
 answered on 17 Nov 2010
9 answers
1.7K+ views
Hi,
Is there a way to hide the first column in GridView? Or at least to change it to size 0-5?

Thanks
Andrew Shyliuk
Top achievements
Rank 1
 answered on 17 Nov 2010
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
CheckedDropDownList
TrackBar
MessageBox
Rotator
SpinEditor
StatusStrip
CheckedListBox
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
DataEntry
ScrollablePanel
ScrollBar
WaitingBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
NavigationView
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?