Telerik Forums
UI for WinForms Forum
1 answer
4.1K+ views

hi,

in a winforms app, i am using a RadGridView with MultiSelect = true and i am trying to create a column with check-boxes that will be checked for each row that is selected.
i want this column to work in both ways:
  1) the check-boxes should update themselves each time the list of selected rows is changed.
  2) the user should be able to select additional rows by checking the check-boxes in this column.

currently i was able to implement the first request (the check-boxes are updating themselves according to the selected rows), but not the second one.

i subscribed to the SelectionChanged event of the grid, i unchecked the previously selected check-boxes and then checked the ones from the currently selected rows. here is the code:


        private readonly List<GridViewRowInfo> previouslySelectedRows = new List<GridViewRowInfo>();

        private void HandleGridSelectionChanged(object sender, EventArgs e)
        {
                UnCheckPreviouslySelectedRows();
                CheckCurrentlySelectedRows();
                StoreCurrentlySelectedRows();
        }

        private void UnCheckPreviouslySelectedRows()
        {
            foreach (GridViewRowInfo row in previouslySelectedRows)
            {
                row.Cells["Select"].Value = false;
            }
        }

        private void CheckCurrentlySelectedRows()
        {
            IEnumerable<GridViewCellInfo> cells = radGridView1.SelectedRows
                .Select(x => x.Cells["Select"]);

            foreach (GridViewCellInfo cell in cells)
            {
                cell.Value = true;
            }
        }

        private void StoreCurrentlySelectedRows()
        {
            previouslySelectedRows.Clear();
            previouslySelectedRows.AddRange(radGridView1.SelectedRows);
        }

did someone implement something similar?
can someone help me with the second task (to let the user select/unselect rows by checking/unchecking the check-boxes)?

thank you,
alez

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 12 Jan 2018
1 answer
345 views

I use Telerik WinForm DateTimePicker.
I can customize it with below code:
Font headerFont = new Font( "Arial", 9.0f, FontStyle.Bold );Font datesFont = new Font( "Arial", 9.0f, FontStyle.Italic );RadDateTimePickerCalendar calendarBehavior = this.radDateTimePicker1.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar;RadCalendar calendar = calendarBehavior.Calendar as RadCalendar;RadCalendarElement calendarElement = calendar.CalendarElement as RadCalendarElement; calendarElement.CalendarNavigationElement.Font = headerFont; calendarElement.CalendarNavigationElement.ForeColor = Color.Yellow; calendarElement.CalendarNavigationElement.BackColor = Color.White; calendarElement.CalendarNavigationElement.BackColor2 = Color.Gray; calendarElement.CalendarNavigationElement.BackColor3 = Color.DarkGray; calendarElement.CalendarNavigationElement.BackColor4 = Color.Gainsboro; calendarElement.CalendarNavigationElement.BorderColor = Color.DarkGray;MonthViewElement monthView = calendarBehavior.Calendar.CalendarElement.CalendarVisualElement as MonthViewElement;foreach ( RadItem item in monthView.TableElement.Children ){ item.Font = datesFont;}int outint;foreach ( CalendarCellElement cell in ( ( MonthViewElement ) calendarBehavior.Calendar.CalendarElement.Children[ 0 ].Children[ 2 ] ).TableElement.Children ){if ( !int.TryParse( cell.Text, out outint ) ){ cell.Font = new Font( this.radDateTimePicker1.Font.FontFamily, 12 );}}
How can I change the month select font?

 

and also i want set these customization when navigation and select month in zoom or popup

 

Could you help me?

Hristo
Telerik team
 answered on 11 Jan 2018
3 answers
286 views

Hi

1. If the current filter output has no results, what is the proper way to update the datasource of virtualgrid so that it shows no data message and when the filter is reset, it properly populates the virtualgrid again. I am unable to do so; once an empty dataset is set as source, I am unable to repopulate the virtualgrid when the filter is removed. Can you provide an example which uses datatable as datasource rather than a list (as shown in other examples).

2. I want to also add my own custom filtering option to imeplement a regex based filtering (similar to contains,startswith etc).How can I do this.

3. The examples and docs show that data must be re-fetched from the database to update the grid. Since I have millions of rows, I want to know what is the better choice for filtering - re-fetching the data from the database or filtering in-app using LINQ? 

Thanks.

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 10 Jan 2018
4 answers
536 views
I wanted to use RadPopupEditor with a gridview as an associated Control to implement a multiselectmultiColumncombobox.

In Design time, my User Control has a radPopUpEditor and a gridview. I am trying to set the value of radPopUpEditor.AssociatedControl within the property window when an exception occurs saying "Error using the dropdown: Unable to cast object of type 'System.Windows.Forms.UserControl' to type 'System.Windows.Forms.Form'".

I did the same on a form with the same controls (a radPopUpEditor and a radgridview).
Though No Error exception occurs, the gridview is not available choice in the AssociatedControl Property.

With this, I have two questions.

1. Is it possible to use radPopUpEditor within a User Control? 
2. what type of controls can I use to as RadPopupEditor.AssociatedControl?

Abbas
Top achievements
Rank 1
 answered on 10 Jan 2018
4 answers
893 views

I need to be able to programmatically get a list of the column headers that are currently being displayed in the grid.  I.e. my grid has 8 columns; however, the user may have changed the order and hidden some of the remaining columns (via the column chooser). 

How do I ask the grid to give me the columns currently displayed and in left to right order?

Chris Kirkman
Top achievements
Rank 1
 answered on 09 Jan 2018
2 answers
338 views

Hi

I have two radlistviews in a radpageview control in stack viewmode. Both the listviews can potentially have large amounts of data (> 5 million rows) simultaneously. Both the lists need to be loaded when application starts and display a flat list of items (without grouping and sorting) but I need the filtering functionality.

1. I want to show a waiting sign (or a progressbar if possible) so that the user knows he has to wait for the list to load before starting any interactions.It will be good if the lists can be populated in chunks rather than all at once.

2. I want display the details of the selected item when the user double clicks or press enter key on any dataitem. How do I achieve this.

3. I feel ashamed to ask this one - Can I access the selected item text anytime I need it directly from the control or I can only access it on some event and need to store it somewhere for later use?

4. I load the data to populate the lists from the database as dataset using async/await method.The step where I assign the dataset as datasource to listview is very time consuming and makes my application hang.I am not binding the data to the lists as described in the docs here. I simply set the datasource, datamember and displaymember properties.

From a performance perspective, is it a better approach to bind the data as described in the docs?

Please suggest a high performance solution so that my app does not hang or freeze and can easily handle data upto 10 million items per list at least.

Thanks.

Rohit
Top achievements
Rank 1
 answered on 09 Jan 2018
4 answers
185 views

Hello --

I am using the following to populate a datagrid and to setup hierarchical relationships for a parent/child grid:

 

private void radButton1_Click(object sender, EventArgs e)
        {
 
            FlexEDIEntities db = new FlexEDIEntities();
 
            var gridData = (from d in db.billing_transactions
                            where d.status == 1
                            select new
                            {
                                d.Id,
                                d.stop_details.con_name,
                                d.stop_details.con_address1,
                                d.stop_details.con_city,
                                d.weight_billed,
                                d.base_amount,
                               count =  d.billing_transaction_accessorial_charge.Count
                            }).ToList();
 
 
            main_grid.DataSource = gridData;
            if (this.main_grid.Relations.Count == 0) // does not exist yet
            {
                
            GridViewRelation relation = new GridViewRelation(this.main_grid.MasterTemplate);
            relation.ChildTemplate = accessorial_template;
            relation.RelationName = "TransToCharges";
            relation.ParentColumnNames.Add("Id");
            relation.ChildColumnNames.Add("billing_transaction_id");
            this.main_grid.Relations.Add(relation);
 
            }
        }

 

I have a lot of these to do in this project so I am trying to not have to have a bunch of extra data sources in the project.

It is not necessary that the datagrid update the underlying data source as edits will be handled by dedicated screens.
Can I set up the child data source using a linq query, either by modifying the one above or having a second one that is dedicated for the child relationship?

 

Thank you --

 

Joe

Hristo
Telerik team
 answered on 09 Jan 2018
6 answers
413 views
I want to save the selection made by user in radgridview column chooser so on next time binding the grid we can hide the columns selected by user.I didn't find any event that is fired so I can save the items added in column chooser.Is there any way to do so?
Hristo
Telerik team
 answered on 09 Jan 2018
1 answer
95 views

How can I get word by word from RadRichtextbox ? For instance:

---------------------------------------------------------

%
{#Program}{toollist}
G0 G90 X49 {N_block}

---------------------------------------------------------

I need follow result. Sometimes I have spaces between word sometimes not.
So I think I have to split between all ABCDE...XYZ and between { } characters.

word[1]="%"
word[2]="{#Program}"
word[3]="{loollist}"
word[4]="G0"
word[5]="G90"
word[6]="X49"
word[7]={N_block}

 

 

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 09 Jan 2018
1 answer
60 views

Hi,

I want to know about the license for Winforms per developer means ? What are the benefits if i buy this license ? 

 

Thanks.

Imer
Telerik team
 answered on 08 Jan 2018
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
GanttView
Diagram, DiagramRibbonBar, DiagramToolBox
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
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
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
WaitingBar
DataEntry
ScrollablePanel
ScrollBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
Styling
Barcode
BindingNavigator
PopupEditor
RibbonForm
TaskBoard
Callout
ColorBox
PictureBox
FilterView
NavigationView
Accessibility
VirtualKeyboard
DataLayout
Licensing
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
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
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?