Telerik Forums
UI for WinForms Forum
1 answer
125 views

Hi,

If I create a shape dynamically and assign it,  who is responsible for the disposal of it?

e.g. where _buttonElement is a RadButtonElement in the code fragment below, do I need to add code to dispose of it or will the ButtonFillElement do it?

_buttonElement.ButtonFillElement.Shape = new EllipseShape();

thanks in advance.
Dimitar
Telerik team
 answered on 25 Jul 2016
4 answers
130 views

Hello,

i use the ViewCellFormatting event to set an icon in the group header. It works, but how can i determining the group if i have more than one grouped column (something like the SummaryItem in the GroupSummaryEvaluationEventArgs).

Here my event handler for th ViewCellFormattingEvent:

private void OnGridViewCellFormatting(object sender, CellFormattingEventArgs e)
{
  //Need the group here
  GridCellElement gce = e.CellElement;
  if (gce is GridGroupContentCellElement)
  {
    GridData gd = GetGridData(e); //Get the needed data
 
    gce.DrawFill = true;
    gce.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
    gce.BackColor = SystemColors.ControlLight;
    gce.Image = gd == null ? null : gd.Point.Marker ? _okImage : _nokImage;
  }
}

Thank you

Christoph

Christoph
Top achievements
Rank 1
 answered on 22 Jul 2016
1 answer
1.3K+ views

Hello,

This is a not an issue with RadGridView per say, but somewhat related.  Hopefully someone can suggest an alternative solutions for me.

I have a simple RadGridView which is binded to a BindingList with about 2,500 items.  The item that is in BindingList inherits ObservableObject from MVVMLight, hence implements INotifyPropertyChanged interface.  One of my properties is boolean called "Selected" which is binded to a checkbox column.  I have a button "Select All". On click, I need to mark all items as selected.  On the backend, I do a simple foreach loop and set Selected = True.  Here is the code.

foreach (var p in Products)
   p.Selected = true;

Very simple. But this loop takes almost 10 minutes.  I figured out that the issue is related to the BindingList.  I did some isolated Tests (without UI).  Simply created a model that implements INotifyPropertyChanged interface, created 1000, 2000, and 3000 records and evaluated the performance.  The result came out to be the longer the list, the more time per item it takes to set simply selected=true.  Here are results

1000 items => 11 sec total => 0.011 sec/cycle

2000 items => 44 sec total => 0.022 sec/cycle

3000 items => 100 sec total => 0.033 sec/cycle

as you can see the average per cycle increases when there are more items in the BindingList

I did some research and this article explains why this is happening: http://www.blog.dapfor.com/why-bindinglist-is-slow-with-objects-implementing-inotifypropertychanged-interface

I tried using approach from the article above.  My loop works in milliseconds.  Great! But now, my checkbox column in the grid does not get updated until I select each row and loose focus.  Obviously the grid does not get a notification to update its cells.

I also tried setting RaiseListChangedEvents = false before the loop and then  list.RaiseListChangedEvents = true after the loop.  Result is the same.

So my question is

1. Is there an alternative class that implements IBindingList interface which would yield a linear increase in time as more items are added, not exponential?

2. If there is no other way, then I guess my only option is to refresh the grid after I update the binding list.  How do I do this?

3. Any other suggestions?

Thank you in advance.

Dimitar
Telerik team
 answered on 22 Jul 2016
3 answers
181 views

Hi.

I'd like to validate the data of a grid and display validation errors. I'm working with a DataSet and use the column errors of it.
As suggested here (http://www.telerik.com/forums/how-to-set-errortext-when-adding-a-record) I set the Grid's DataSource as a DataView but still no errors are displayed. When setting the error texts manually it works though.

Are there any other prerequisites for the Dataview's columnerrors or is it just not supported by RadGridView?

Sample code:

    Friend WithEvents grd_report_ As Telerik.WinControls.UI.RadGridView

        For i As Integer = 0 To row.Table.Columns.Count - 1
            Select Case row.Table.Columns(i).ColumnName
                Case "some column"
                    If error_condition Then
                        row.SetColumnError(i, "error")
                    End If
                Case ...
           End Select
        Next
        ...
        'doesn't display any errors
       grd_report_.DataSource = ds.Tables(TAB_REPORT).DefaultView()   

        'setting ErrorTexts works
        For Each r As GridViewRowInfo In grd_report_.Rows
            Dim drv = CType(r.DataBoundItem, DataRowView)
            For i As Integer = 0 To r.Cells.Count - 1
                r.Cells(i).ErrorText = drv.Row.GetColumnError(i)
                'has to be set in CellFormatting event apparently!?!?
                'If Not String.IsNullOrEmpty(r.Cells(i).ErrorText) Then
                '    r.Cells(i).Style.BackColor = Color.Red
                '    r.Cells(i).Style.NumberOfColors = 1
                '    r.Cells(i).Style.DrawFill = True
                'End If
            Next
        Next

Best regards,
Bernhard

Hristo
Telerik team
 answered on 21 Jul 2016
2 answers
69 views

Hi,

I'm binding a grid to a collection where one of the properties is of type 'Color'.

I want to validate the selected color, as only a subset of colors are allowed.

The validating event fires twice after changing the value of 'Color col' cell. And hence my msg box is shown twice. Any way around this?

private void StatusRadGridView_CellValidating(object sender, CellValidatingEventArgs e)
{
    if (e.ActiveEditor != null && e.ActiveEditor is GridColorPickerEditor)
    {
        Color c = (Color)e.Value;
        if(!AllowedColors.Exists(o=>o.Name == c.Name))
        {
            e.Cancel = true;
            RadMessageBox.Show(errorMsg);
        }
    }
}

Thomas
Top achievements
Rank 1
 answered on 21 Jul 2016
1 answer
302 views
I need greater than and less than rules in excel like filtering. How can I get it?
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 20 Jul 2016
3 answers
100 views

I want to insert column which index what i want.

so.. i Collocate control and I init first column and rows.

i success to insert column in runtime

but it is'nt editable..

I can edit when use Add(String) method ...

what is difference between?

I doubt columnItem's property.(Inheritanced GridViewDataColumn)

 - code

                        int index =radGridView1.SelectedCells[0].ColumnInfo.Index;

                         columnItem item=new columnItem();

                        radGridView1.Columns.Insert(index,item);

 

Please advise.

excute immature english.

jung
Top achievements
Rank 1
 answered on 20 Jul 2016
9 answers
443 views
Hello
How can right-to-left to form his form in this way?
Dimitar
Telerik team
 answered on 19 Jul 2016
2 answers
680 views

I have a GridView with some bound data. I have an unbound checkbox on the first column... This checkbox simply acts as a marker for further processing... eg on all checked rows, data is saved when a button is pressed...

On change of each checkbox I need to run some validation... which I won't go into here...So I use the event MyGridView_ValueChanged(object sender, EventArgs e).

From this event I use the following code to go through each row and find all the checked checkboxes...

            foreach(GridViewRowInfo gvri in MyGridView.Rows)
            {
                if (Convert.ToBoolean(gvri.Cells["chkSelected"].Value) == true)
                {
                       // Happy Days
                 }
            
}

Even though checking this checkbox fires the ValueChanged event, when this code is run, there are no values that return true for the checkboxes.  If I select another checkbox, the first one now appears as true, but the one I just selected remains false... Why does this not show the changed value in the grid?  Also can you advise if this is possible using any other events / properties?

Thanks

Mohammed
Top achievements
Rank 1
 answered on 19 Jul 2016
1 answer
92 views

Hi,

We are building a pivot table using Telerik to display figure for different dimension.  But my client also require the pivot table to able to select one of the cell (figure) and show the records related to that figure:

For example

             Jan 2016

Type A        10

Type B          8

The requirement is to click the figure 10 and somewhere show the 10 records which fits the criteria Jan 2016 and Type A.

Is there anyway to do so?

Thanks

Hristo
Telerik team
 answered on 19 Jul 2016
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)
Form
Chart (obsolete as of Q1 2013)
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
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
VirtualGrid
Toolstrip (obsolete as of Q3 2010)
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
CheckedDropDownList
ProgressBar
TrackBar
MessageBox
Rotator
SpinEditor
CheckedListBox
StatusStrip
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
CollapsiblePanel
Conversational UI, Chat
DateTimePicker
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
FileDialogs
ColorDialog
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
Styling
Barcode
PopupEditor
RibbonForm
TaskBoard
Callout
NavigationView
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
BreadCrumb
ButtonTextBox
FontDropDownList
BarcodeView
Security
LocalizationProvider
Dictionary
SplashScreen
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
ToolbarForm
NotifyIcon
DateOnlyPicker
AI Coding Assistant
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?