Telerik Forums
UI for WinForms Forum
2 answers
243 views
Hi,
I have implemented the 'Check All Header Cell' as shown in this KB article http://www.telerik.com/support/kb/winforms/gridview/add-check-uncheck-all-check-box-in-the-header-cell.aspx.

This works really well in most scenarios but I have run into a small bump in the road. The problem is that I have two grids that are linked in a cascading style. The purpose of this is to fill grid 2 with all of the contacts relating to the selected person or people in grid 1. Again this is all working perfectly for single or multiple selections using the normal check boxes in the rows.

I am hooking in to the ValueChanged event and then checking the cell type to determine if it is a single or check all operation. I set a processing flag to avoid multiple runs of the population code. The flag is reset in the DataBindingComplete event.

private void PupilGrid_ValueChanged(object sender, EventArgs e)
        {
            //set a processing flag as if the select all checkbox is used this
            //event fires for every checkbox in the column!
            if (_populatingParentGrid) return;
 
            _populatingParentGrid = true;
 
            if (sender.GetType() == typeof(GridViewCellInfo))
            {
                //this means the select all box has been checked
                RefreshParentGrid(true);
            }
            else if (sender.GetType() == typeof(RadCheckBoxEditor))
            {
                //single box checked
                RefreshParentGrid(false);
            }
        }
 
private void ParentGrid_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
        {
            //reset processing flag
            _populatingParentGrid = false;
            //PupilGrid.Enabled = true;        }

The problem I am getting is that the databinding is so fast that the flag is reset almost instantly. The 'Check All' code from the KB article  works by setting each checkbox to checked in a loop. This is firing the ValueChanged event and running the Grid 2 population code over and over again resulting in a lengthy delay (30 secs +) when the header cell is clicked.

I need a way to notify my app that the 'Check All' operation has finished (that is all of the check boxes have had their state changed and there are no other ValueChanged events to be raised). The following method from CheckBoxHeaderCell.cs is where I would expect see an event being raised from, but I cannot figure out a way to hook such an event from my app or make it bubble up via the grid.

private void checkbox_ToggleStateChanged(object sender, StateChangedEventArgs args)
        {
            if (suspendProcessingToggleStateChanged) return;
            bool valueState = false;
 
            if (args.ToggleState == ToggleState.On)
            {
                valueState = true;
            }
            GridViewElement.EditorManager.EndEdit();
            TableElement.BeginUpdate();
 
            foreach (GridViewRowInfo t in ViewInfo.Rows)
            {
                t.Cells[ColumnIndex].Value = valueState;
            }
 
            TableElement.EndUpdate(false);
 
            TableElement.Update(GridUINotifyAction.DataChanged);
 
            //Need to raise an event here to say that the processing has finished
        }

I add the column to my grid using the following code, I have checked the events available to 'checkColumn' and there is nothing suitable that I can see.

private void AddCheckColumn()
       {
           //Telerik code - see above for link
           var checkColumn = new CustomCheckBoxColumn {Name = "Select", HeaderText = "All", ReadOnly = false};
           //No suitable events found here
           PupilGrid.Columns.Insert(0, checkColumn);
           var checkColumn2 = new CustomCheckBoxColumn {Name = "Select", HeaderText = "All", ReadOnly = false};
           ParentGrid.Columns.Insert(0, checkColumn2);
       }


Can you please let me know if there is a way to raise an event from this custom header cell that can be hooked into by my app.

Many Thanks

Chris

Svett
Telerik team
 answered on 27 Feb 2012
4 answers
193 views
Hi,
Can you please advice how to remove the extra space as highlighted in RED box?
Thanks.
Yip Yew Kwong
Top achievements
Rank 1
 answered on 27 Feb 2012
2 answers
202 views
Hi,

I am having trouble with the first value displayed in a dropdownlist. The column is bound to a datasource that contains all possible values in the forms load event. Under the cell editor initialized event I change the drop down list editor element's datasource to only show relevant values based on another columns value. This is all working fine with correct values being populated in the list. However if I select the first value in the drop down list it does not display. All the other values work as expected.

 

Load event:
Dim ListDisplayColumn As GridViewComboBoxColumn = dgvReportingIndicators.Columns("ListSwitchDisplay")
            ListDisplayColumn.DataSource = Me.TrafficLightIndicatorsTableAdapter.GetData
            ListDisplayColumn.DisplayMember = "DisplayName"
            ListDisplayColumn.FieldName = "ListSwitch"
            ListDisplayColumn.ValueMember = "ID"

CellEditorInitialized event:
If e.Column.Name = "ListSwitchDisplay" Then
                Dim dropDownEditor = TryCast(dgvReportingIndicators.ActiveEditor, RadDropDownListEditor)
                Dim element = TryCast(dropDownEditor.EditorElement, RadDropDownListEditorElement)
                Select Case e.Row.Cells("IndicatorTypeDisplay").Value
                    Case "Count"
                        element.DataSource = Me.TrafficLightIndicatorsTableAdapter.GetNotApplicable
                    Case "Traffic Light"
                        element.DataSource = Me.TrafficLightIndicatorsTableAdapter.GetTL
                End Select
                element.ShowPopup()
            End If
Justin
Top achievements
Rank 1
 answered on 26 Feb 2012
4 answers
228 views
hi i need to change the GridView row backcolor using index in the RadButton Click event
Stefan
Telerik team
 answered on 24 Feb 2012
2 answers
210 views
I have a custom VisualItem (class CustomVisualItem : IconListViewVisualItem) and I want a nice image of this item while dragging.
So I wrote this in my VisualItem, but this method never get called (no message in output).
protected override Image GetDragHintCore()
       {
          Debug.WriteLine("GetDragHintCore");
          return GetAsBitmap(Brushes.Yellow, 2, new SizeF(48, 48));      
       }

Is it a bug or my fault?
Ps: There is pretty much no docu on these to methods (GetDragHintCore and GetAsBitmap [what about the parameters?]).

Froggie
Top achievements
Rank 1
 answered on 24 Feb 2012
1 answer
248 views
Hi,

I've posted about this before, but two days later the thread disappeared, wierd!
Anyway, i have more details now.
I have an app which uses a gridview with a combobox column. the combobox column uses suggestAppend
It seems the combobox column, by default, requires the user to hit enter twice before EndEdit is called.

The grid itself has a custom GridBehavior to override ProcessKey such that when enter is pressed, it calls EndEdit and SelectNextRow
This is so that on the combobox column, the user only has to hit enter once.

this worked on version 2010.2.10.914 of the telerik controls, i am now using the latest version and it no longer works. ProcessKey is never called while the suggestions list is showing.

Is there a way for me to get the KeyPress events from the suggestion box to bubble up to the gridview?

Thanks,
Matt
Stefan
Telerik team
 answered on 24 Feb 2012
1 answer
184 views
Hello almighty telerik team,
i  apologise for not speaking well english, no my mother language.
to my problem - i can no make ribbon height bigger. i tried seting in the designer but no luck.
please show sample or code to make this. i write from my coleague acount in india. regards from asia,
suresh rajeshkumar
Peter
Telerik team
 answered on 24 Feb 2012
2 answers
314 views
Hi,

I want to change a GridViewCheckBoxColumn to display a red Cross Mark instead of the green Tick Mark.

Is this possible and if so how?

Kind Regards,
Brad
Boryana
Telerik team
 answered on 24 Feb 2012
1 answer
258 views
Hey Telerik!

We are currently evalutaing your windows forms control suite and have hit a road block.  One of our custom controls that we created relies on a base windows form which contains all the drag/drop logic, etc.  The other forms then inherit from this base form.  This works perfectly with regular windows forms.

When I tried to set up a simple scenario with a base form and have a second form inherit from the base, I am unable to add any controls in the designer and instead am greeted with this design error:

"   The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: InheritBase --- The base class 'WindowsApplication1.RadFormBase' could not be loaded. Ensure the assembly has been referenced and that all projects have been built. "

I have uploaded my simple test here :  http://www.vbninja.com/baseformtest.zip

Thanks
Mark
Stefan
Telerik team
 answered on 24 Feb 2012
2 answers
320 views
Hi,

What is the best way to validate a raddropdownlist?  I'v looked at the _Validating Event but this appears to only fire when you select another control.

When I try the selectedvlue_changed this appears to fire when the control is being databound etc.

Any help or pointers would be great.

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