Telerik Forums
UI for WinForms Forum
1 answer
227 views
I have a RadScheduler with a datasource initated like this:

private void InitiateBookingDataSource()
        {
            if (_appointmentBookings == null) _appointmentBookings = new BindingList<Booking>();
 
            var dataSource = new SchedulerBindingDataSource();
            var mappingInfo = new AppointmentMappingInfo
                                  {
                                      Start = "StartTime",
                                      End = "EndTime",
                                      Summary = "BookingSubject",
                                      Description = "BookingDescription",
                                      BackgroundId = "BackgroundId",
                                      AllDay = "AllDay",
                                      RecurrenceRule = "RecurrenceRule",
                                      Exceptions = "Exceptions",
                                      MasterEventId = "MasterEventId",
                                      Visible = "Visible"
                                  };
 
            mappingInfo.Mappings.Add(new SchedulerMapping("CaseId", "CaseId"));
            mappingInfo.Mappings.Add(new SchedulerMapping("PratId", "PratId"));
            mappingInfo.Mappings.Add(new SchedulerMapping("BoothId", "BoothId"));
            mappingInfo.Mappings.Add(new SchedulerMapping("CaseDesc", "CaseDesc"));
            mappingInfo.Mappings.Add(new SchedulerMapping("BoothDesc", "BoothDesc"));
 
            dataSource.EventProvider.Mapping = mappingInfo;
            dataSource.EventProvider.DataSource = _appointmentBookings;
            dataSource.EventProvider.AppointmentFactory = rsBookings.AppointmentFactory;
 
            rsBookings.DataSource = dataSource;
        }

The appointments are initiated and updated by calling the method below. The problem is that it takes "forever" if the number of appointments exceeds approx 50. Is there a way to speed it up? I have tried async await, but as I am new to that procedure I haven't been able to implement it successfully.

Regards, Jill-Connie Lorentsen
private void InitiateAppointments(IEnumerable<Booking> bookings)
       {
           try
           {
               if (_appointmentBookings == null) _appointmentBookings = new BindingList<Booking>();
                
               rsBookings.Appointments.Clear();
               _appointmentBookings.Clear();
                
               foreach (var booking in bookings)
               {
                   var appointment = booking;
                   appointment.BackgroundId = _booths.Find(b => b.BoothId == booking.BoothId).BackgroundId;
                   appointment.Exceptions.ForEach(b => b.BackgroundId = _booths.Find(x => x.BoothId == b.BoothId).BackgroundId);
                   _appointmentBookings.Add(appointment);
               }
             
           }
           catch (Exception ex)
           {
              MessageBox.Show(ex.Message);
           }            
       }
George
Telerik team
 answered on 26 Jun 2014
3 answers
148 views
Hi,

I'm creating a GridView like MS Excel.
If the user reach the last row and press arrow down it will add new row.
And also i want to apply this add new row on Scrolling.
I'd appreciate if you can help.
Thanks.
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 25 Jun 2014
3 answers
316 views
I am trying to set the RadDropDownButton font color by programming by setting  this.btnActionOfDeviceTask.ForeColor,but the font color does change at all, is there the way to set the font color?
            // 
            // btnActionOfDeviceTask
            // 
            this.btnActionOfDeviceTask.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.btnActionOfDeviceTask.Items.AddRange(new Telerik.WinControls.RadItem[] { 
            this.btnEnableDeviceofTask,
            this.btnDisableDeviceOfTask}
            );
            this.btnActionOfDeviceTask.Location = new System.Drawing.Point(310, 7);
            this.btnActionOfDeviceTask.Name = "btnActionOfDeviceTask";
            this.btnActionOfDeviceTask.Text = "Edit task state";
            this.btnActionOfDeviceTask.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular);
            this.btnActionOfDeviceTask.ForeColor = System.Drawing.Color.FromArgb(21, 66, 139);
            this.btnActionOfDeviceTask.BackColor = System.Drawing.Color.Transparent; 
            this.btnActionOfDeviceTask.Size = new System.Drawing.Size(136, 24);
            this.btnActionOfDeviceTask.TabIndex = 77;
            this.btnActionOfDeviceTask.Enabled = false;
Stefan
Telerik team
 answered on 25 Jun 2014
7 answers
1.9K+ views
Hi,

I'm using Version 2011.1.11.419, and have been tasked to do some performance tuning I noticed that the Cellformatting event gets called a bit more often than I would like, especially at form loading.  I found that if I place the code to set the datasource for the radGridView in the load event of the form, that it gets called much more frequently than if placed in the forms constructor.

In the code snippets below, I'm creating a simple grid with 5 columns and 2 rows - all of type GridTextBoxColumn.  When assigning the datasource in the constructor, it generates 25 calls to the CellFormatting event. If I move the datasource assignment to the form load event, it generates 35 calls. The problem is even more pronounced when I call the radGridView.LoadLayout function.  If placed in the constructor,  it still calls the CellFormatting event 25 times, but when I move both the datasource and LoadLayout calls to the form load event, CellFormatting gets called a whopping 90 times!  Note that the xml file that I'm using is nothing crazy - simply the output from saving the contents of this grid in Visual Studio using the radGridView property builder.

I've tried to use  radGridView.BeginInit, and radGridView.SuspendLayout to decrease the number of calls while the grid is being set up, but neither seem to have any effect.  Should I resign myself to moving radGridView code to the forms constructor, or is there a way to accomplish this in the form load event?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
using Telerik.WinControls.UI;
 
 
namespace RadGridTest
{
    public partial class Form1 : Form
    {
 
        private Telerik.WinControls.UI.RadGridView radGridView1;
        private int execCount = 0;
        private int beginTime;
        private int endTime;
        private BindingList<MyData> list;
 
        public Form1()
        {
           beginTime = Environment.TickCount;
           InitializeComponent();
 
           list = new BindingList<MyData>(); ;
           for (int i = 0; i <= 1; i++)
           {
               list.Add(new MyData(100, i, i));
           }
           //radGridView1.DataSource = list;
           //radGridView1.LoadLayout("gridFormat.xml");
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            // These commented lines cause much additional overhead in calling the CellFormatting function
            // from the form_load event rather than the constructor.
 
            radGridView1.DataSource = list;
            radGridView1.LoadLayout("gridFormat.xml");
 
 
            endTime = Environment.TickCount;
            MessageBox.Show("Load Time: " + (endTime - beginTime).ToString() + Environment.NewLine +
                            "gridformat calls: " + execCount.ToString());
        }
 
        void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
        {
            execCount++;
            if (e.CellElement.ColumnInfo is GridViewDataColumn)
            {
                GridViewDataColumn dataCol = e.CellElement.ColumnInfo as GridViewDataColumn;
                if (e.CellElement.Text != "")
                switch (dataCol.FieldName)
                {
                    case "B": e.CellElement.Text = Convert.ToDecimal(e.CellElement.Value).ToString("C");
                        break;
                    case "D":
                    case "E":
                        if (Convert.ToDecimal(e.CellElement.Value) % 2 == 0)
                            e.CellElement.Text = Convert.ToDecimal(e.CellElement.Value).ToString("#,##0.0000");
                        else
                            e.CellElement.Text = Convert.ToDecimal(e.CellElement.Value).ToString("#,##0.00");
                        break;
                }
            }
        }
 
    }
 
    public class MyData
    {
        public string A { get; set; }
        public int B { get; set; }
        public string C { get; set; }
        public int D { get; set; }
        public int E { get; set; }
 
        public MyData(int b, int d, int e)
        {
            A = "Money";
            B = b;
            C = "Float";
            D = d;
            E = e;
        }
    }
}
  
 
 
// radGridView designer settings below
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            Telerik.WinControls.UI.GridViewTextBoxColumn gridViewTextBoxColumn1 = new Telerik.WinControls.UI.GridViewTextBoxColumn();
            Telerik.WinControls.UI.GridViewTextBoxColumn gridViewTextBoxColumn2 = new Telerik.WinControls.UI.GridViewTextBoxColumn();
            Telerik.WinControls.UI.GridViewTextBoxColumn gridViewTextBoxColumn3 = new Telerik.WinControls.UI.GridViewTextBoxColumn();
            Telerik.WinControls.UI.GridViewTextBoxColumn gridViewTextBoxColumn4 = new Telerik.WinControls.UI.GridViewTextBoxColumn();
            Telerik.WinControls.UI.GridViewTextBoxColumn gridViewTextBoxColumn5 = new Telerik.WinControls.UI.GridViewTextBoxColumn();
            this.radGridView1 = new Telerik.WinControls.UI.RadGridView();
            ((System.ComponentModel.ISupportInitialize)(this.radGridView1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.radGridView1.MasterTemplate)).BeginInit();
            this.SuspendLayout();
            //
            // radGridView1
            //
            this.radGridView1.BackColor = System.Drawing.SystemColors.Control;
            this.radGridView1.Cursor = System.Windows.Forms.Cursors.Default;
            this.radGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.radGridView1.Font = new System.Drawing.Font("Segoe UI", 8.25F);
            this.radGridView1.ForeColor = System.Drawing.SystemColors.ControlText;
            this.radGridView1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
            this.radGridView1.Location = new System.Drawing.Point(0, 0);
            //
            // radGridView1
            //
            this.radGridView1.MasterTemplate.AutoGenerateColumns = false;
            gridViewTextBoxColumn1.FieldName = "A";
            gridViewTextBoxColumn1.FormatInfo = new System.Globalization.CultureInfo("");
            gridViewTextBoxColumn1.FormatString = "";
            gridViewTextBoxColumn1.HeaderText = "column1";
            gridViewTextBoxColumn1.Name = "column1";
            gridViewTextBoxColumn1.Width = 76;
            gridViewTextBoxColumn2.FieldName = "B";
            gridViewTextBoxColumn2.FormatInfo = new System.Globalization.CultureInfo("");
            gridViewTextBoxColumn2.FormatString = "";
            gridViewTextBoxColumn2.HeaderText = "column2";
            gridViewTextBoxColumn2.Name = "column2";
            gridViewTextBoxColumn2.Width = 81;
            gridViewTextBoxColumn3.FieldName = "C";
            gridViewTextBoxColumn3.FormatInfo = new System.Globalization.CultureInfo("");
            gridViewTextBoxColumn3.FormatString = "";
            gridViewTextBoxColumn3.HeaderText = "column3";
            gridViewTextBoxColumn3.Name = "column3";
            gridViewTextBoxColumn3.Width = 82;
            gridViewTextBoxColumn4.FieldName = "D";
            gridViewTextBoxColumn4.FormatInfo = new System.Globalization.CultureInfo("");
            gridViewTextBoxColumn4.FormatString = "";
            gridViewTextBoxColumn4.HeaderText = "column4";
            gridViewTextBoxColumn4.Name = "column4";
            gridViewTextBoxColumn4.Width = 90;
            gridViewTextBoxColumn5.FieldName = "E";
            gridViewTextBoxColumn5.FormatInfo = new System.Globalization.CultureInfo("");
            gridViewTextBoxColumn5.FormatString = "";
            gridViewTextBoxColumn5.HeaderText = "column5";
            gridViewTextBoxColumn5.Name = "ProgressBar";
            gridViewTextBoxColumn5.Width = 88;
            this.radGridView1.MasterTemplate.Columns.AddRange(new Telerik.WinControls.UI.GridViewDataColumn[] {
            gridViewTextBoxColumn1,
            gridViewTextBoxColumn2,
            gridViewTextBoxColumn3,
            gridViewTextBoxColumn4,
            gridViewTextBoxColumn5});
            this.radGridView1.Name = "radGridView1";
            this.radGridView1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
            this.radGridView1.ReadOnly = true;
            this.radGridView1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            //
            //
            //
            this.radGridView1.RootElement.Padding = new System.Windows.Forms.Padding(0, 0, 0, 1);
            this.radGridView1.ShowGroupPanel = false;
            this.radGridView1.Size = new System.Drawing.Size(599, 416);
            this.radGridView1.TabIndex = 0;
            this.radGridView1.Text = "radGridView1";
            this.radGridView1.CellFormatting += new Telerik.WinControls.UI.CellFormattingEventHandler(this.radGridView1_CellFormatting);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(599, 416);
            this.Controls.Add(this.radGridView1);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            ((System.ComponentModel.ISupportInitialize)(this.radGridView1.MasterTemplate)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.radGridView1)).EndInit();
            this.ResumeLayout(false);
 
        }
 
        #endregion

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 24 Jun 2014
2 answers
248 views
For C# winforms.
I wanted to check for each cells in a RadGridView. Wanted to add a eventhandler, once all data dataloaded.
For the cell with value "Completed" I would like to change the cell into a button, lets say a radButton named "radButtonView".

Anyone have any idea how to do that?
A simple example will do :)
Jacky
Top achievements
Rank 1
 answered on 24 Jun 2014
1 answer
219 views
I am having a problem using filtering with a column which has a DataTypeConverter specified.

My object has a bool value which I have bound to a text box column.  I use a TypeConverter to convert this bool to a string (and back); true converts to "group", false converts to "individual".  This works fine except when I try to use filtering.  I chose "equals" and entered "individual"; I expected my type converter to be called so it could convert "invidual" to false, but the type converter was not getting called at all.  When I entered "false" into the filter my type converter was finally called but was passed a bool; it wanted me to convert bool to bool?!.  It seems that the filter is converting the string to bool itself and not using my type converter.  After I typed in "false" the filter showed "Equals: individual" and seemed to work correctly. 

This  behavior is a problem since I cannot ask my end users to type in "true" and "false" and remember which maps to which display value.  It seems like not using my specified TypeConverter to convert the string back to the match value is a bug. 

Can you suggest a work around?  Will this be fixed?

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 24 Jun 2014
5 answers
117 views
Hello,
telerik radgrid dissapearing on postback ,
when i click in radgrid , its postback and dissapear , plz anyone help asap.


thanks in advance

Regards,
Muhammad Arsal Khan
Pavlina
Telerik team
 answered on 24 Jun 2014
12 answers
710 views
Hi,

I am using the code from the link http://www.telerik.com/support/kb/winforms/gridview/creating-a-radradiobuttoncellelement.aspx to create a RadRadioButtonElement. Unlike the example provided, I am using just one radiobutton per cell instead of three. 

At the row level the RadRadioButtonElement should function like a checkbox. User should be allowed to set the ToggleState to On or Off on a particular row.

Among the rows in the RadGridView, there cannot be more than one row which has this column's ToggleState set to On.

Please check the attached image to get an idea.
Dimitar
Telerik team
 answered on 24 Jun 2014
1 answer
156 views
I'm setting the backcolor and forecolor of SubItems in the radListView1_CellFormatting event.  Later, I'm exporting my List View to Excel, and I need to access the backcolor and forecolor of each SubItem/cell.  Is this possible?  I see the property for Item backcolor, but I can't get at the SubItem backcolor.
George
Telerik team
 answered on 23 Jun 2014
1 answer
187 views
I'm able to edit cells correctly, however, if there is a cell with a particular long sentence, it will go to the end of the sentence when I click into the cell to edit.
Example, a cell containing a sentence
"I watched XXXXX TV show this weekend" - I click in there and I can click directly into the XXXXX as the sentence isn't too long.
"I first went to the store then came home and watched XXXXX TV show" - I click in there and it will highlight the sentence but take me to the last part of the sentence that fills up the cell.

Is there a way to adjust where you can click into the cell or an easier way to edit in the situation where a sentence is much longer?

Thanks,
Jeff
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 23 Jun 2014
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
SplitContainer
Documentation
Map
DesktopAlert
CheckedDropDownList
ProgressBar
MessageBox
TrackBar
Rotator
SpinEditor
CheckedListBox
StatusStrip
CollapsiblePanel
LayoutControl
ShapedForm
SyntaxEditor
Wizard
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
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?