Hello there,
I have some problems with the gridview control when using three-stated checkboxcolumns. To recreate the problem, create a new telerik winforms project and in the mainform add a gridview. Dock this gridview to the form.
Then, add the following columns and change the options as follows:
GridViewTextBoxColumm
FieldName: Id
Name: Id
MinWidth: 80 (important for later)
GridViewTextBoxColumm
FieldName: Name
Name: Name
MinWidth: 150
GridViewCheckBoxColumn
FieldName: Test1
Name: Test1
MinWidth: 80
ThreeState: true
GridViewCheckBoxColumn
FieldName: Test2
Name: Test2
MinWidth: 80
ThreeState: true
GridViewCheckBoxColumn
FieldName: Test3
Name: Test3
MinWidth: 80
ThreeState: true
GridViewDateTimeColumn
FieldName: CurrentDateTime
Name: CurrentDateTime
MinWidth: 200
GridViewDecimalColumn
FieldName: Nr
Name: Nr
GridViewCheckBoxColumn
FieldName: Test4
Name: Test4
MinWidth: 80
The extra columns and minimal width are only there to make the sure you can scroll horizontally.
Change the codebehind for RadForm1 to the following:
public partial class RadForm1 : Telerik.WinControls.UI.RadForm { public RadForm1() { InitializeComponent(); } private void RadForm1_Load(object sender, EventArgs e) { this.radGridView1.DataSource = GetTestData(); } private List<TestData> GetTestData() { List<TestData> test = new List<TestData>(); for (int i = 0; i < 100; i++) { test.Add(new TestData() { Id = i + 1, Name = i.ToString(), Test1 = i % 2 == 0 ? true : (bool?)null, Test2 = i % 3 == 0 ? false : (bool?)null, Test3 = i % 5 == 0 ? (bool?)null : false, CurrentDateTime = DateTime.Now, Nr = i, Test4 = i % 2 == 0 ? true : false }); } return test; } }To trigger the error, run the project, do not enlarge the window, and try to add a new line. Fill in a new id and a new name, keep Test1 to it's initial (third) state and uncheck Test2. Then, without pressing enter, scroll left and right by grabbing the horizontal scrollbar and moving quickly left and right. At that moment you should get the following error:
TargetInvocationException: bij System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) bij System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) bij System.Reflection.RuntimeMethodInfo.UnsafeInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) bij System.Delegate.DynamicInvokeImpl(Object[] args) bij System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme) bij System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj) bij System.Threading.ExecutionContext.RunInternal(ExecutionContext (Innerexception) NullReferenceException: bij Telerik.WinControls.UI.BaseGridEditor.OnValueChanging(ValueChangingEventArgs e) bij Telerik.WinControls.UI.RadCheckBoxEditor.SetValue(Object value) bij Telerik.WinControls.UI.RadCheckBoxEditor.set_ThreeState(Boolean value) bij Telerik.WinControls.UI.GridCheckBoxCellElement.SetThreeState(GridViewColumn column) bij Telerik.WinControls.UI.GridCheckBoxCellElement.Initialize(GridViewColumn column, GridRowElement row) bij Telerik.WinControls.UI.GridVirtualizedCellElement.Attach(GridViewColumn data, Object context) bij Telerik.WinControls.UI.GridCheckBoxCellElement.Attach(GridViewColumn data, Object context)
So, my question would be: what am I doing wrong and how can I avoid this?
Thanks in advance
Hi!
I have a Telerik GridView (RadGridView1), and two columns of this GridView contains cells (GridDataCellElement) with charts (RadChartElement())
Durung the scrolling all the cells are distorting. I've read a lot of topics, but I still don't understand how should I fix it. My case is different, than others.
How can I fix it?
Private Sub InitalizeGrid()
AddHandler RadGridView1.CreateCell, AddressOf radGridView1_CreateCell
Me.RadGridView1.TableElement.RowHeight = 130
Me.RadGridView1.ReadOnly = True
Me.RadGridView1.AutoExpandGroups = True
Me.RadGridView1.AllowAddNewRow = False
Me.RadGridView1.AllowColumnReorder = True
Me.RadGridView1.EnableSorting = True
Me.RadGridView1.ShowGroupPanel = False
Me.RadGridView1.ShowRowHeaderColumn = True
Me.RadGridView1.ForeColor = Color.Black
Me.RadGridView1.AllowSearchRow = True
Me.RadGridView1.AutoGenerateColumns = False
Me.RadGridView1.VirtualMode = False
Me.RadGridView1.MasterTemplate.VirtualMode = False
RadGridView1.MasterTemplate.Columns.Add(newTextBoxColumn("ID", 100, "ID"))
RadGridView1.MasterTemplate.Columns.Add(newTextBoxColumn("Name", 220, "Name"))
RadGridView1.MasterTemplate.Columns.Add(newTextBoxColumn("Chart 1", 220, "Chart 1))
RadGridView1.MasterTemplate.Columns.Add(newTextBoxColumn("Chart 2", 220, "Chart 2"))
'SQL
Dim sqlDt As SqlDataTable
Try
----------------------------------------------
Dim sqlDa As New SqlDataAdapter()
sqlDa.SelectCommand = SqlCmd
sqlDa.Fill(sqlDt)
----------------------------------------------
Me.RadGridView1.MasterTemplate.BeginUpdate()
RadGridView1.DataSource = sqlDt
Me.RadGridView1.MasterTemplate.EndUpdate()
gvSourceAnalysis.DataSource = sqlDt
sqlDa.Dispose()
Catch ex As Exception
Throw ex
End Try
End Sub
Private Function newTextBoxColumn(ByVal columnName As String, ByVal columnWidth As Integer, ByVal fieldName As String) As GridViewTextBoxColumn
Dim textBoxColumn As New GridViewTextBoxColumn()
textBoxColumn.Name = columnName
textBoxColumn.HeaderText = columnName
textBoxColumn.FieldName = fieldName
textBoxColumn.Width = columnWidth
textBoxColumn.TextAlignment = ContentAlignment.BottomRight
textBoxColumn.ReadOnly = True
Return textBoxColumn
End Function
Private Sub radGridView1_CreateCell(ByVal sender As Object, ByVal e As GridViewCreateCellEventArgs)
If e.CellType Is GetType(GridDataCellElement) AndAlso (e.Column.Name = "Chart 1" OrElse
e.Column.Name = "Chart 2" OrElse) Then
Dim chart As New RadChartElement()
Dim lineSeries As New LineSeries()
chart.View.Margin = New Padding(3)
chart.GradientStyle = Telerik.WinControls.GradientStyles.Solid
chart.AutoToolTip = True
chart.View.ShowTrackBall = True
lineSeries = New LineSeries()
lineSeries.BorderColor = Color.FromArgb(68, 68, 68)
'lineSeries.PointSize = New SizeF()
If sqlDt.Rows.Count > 0 Then
If e.Column.Name = "Chart 1" Then
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql1"))), "1"))
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql2"))), "2"))
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql3"))), "3"))
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql4"))), "4"))
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql5"))), "5"))
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql6"))), "6"))
ElseIf e.Column.Name = "Chart 2" Then
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql7"))), "7"))
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql8"))), "8"))
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql9"))), "9"))
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql10"))), "10"))
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql11"))), "11"))
lineSeries.DataPoints.Add(New CategoricalDataPoint(CDbl(Val(sqlDt.Rows(e.Row.Data.Index).Item("ColumnFromSql12"))), "12"))
End If
End If
chart.View.Series.Add(lineSeries)
Dim gridDataCell As New GridDataCellElement(e.Column, e.Row)
gridDataCell.Padding = New Padding(0)
gridDataCell.Children.Add(chart)
e.CellElement = gridDataCell
e.CellType = GetType(GridDataCellElement)
End If
End Sub

I'm having issues with the theming of the RadDropDownList using the VisualStudio2012Light theme. I've set my RDDL to have a height of 20px and without theming the text vertically centers normally and there are no hassles whatsoever. As soon as I apply the theme then things start getting pear shaped.
The RDDL automatically adjusts its height to 24px which is not what I want. This mismatches all the other controls I have with the same theme - none of them resize when the theme is applied.
When I adjust the height of the RDDL to 20px after the theming has been applied the height adjusts fine but the text remains in the same position and gets cut off. The offset doesn't adjust.
I know in the past themes have been buggy at times but this is the first time I've come across this particular issue. I can say for certain that with 2013.2.724.40 this wasn't an issue but after checking some other versions it was also a problem in 2015 Q2.
I'm using VS2012, .NET 4.0. The attached image shows:
1. How the text is cut off
2. How the RDDL resized itself
3. How the RDDL compares to a RadTextBox and a RadDateTimePicker

Hi,
I have a problem with unselecting the new Row in my grid.
To explain the problem, i have a grid, where the user can add data to by using the new Row.
When clicking the new Row, it gets populated with some default data and can be edited.
I wanted to make sure the edited data gets saved when the user leaves the new Row,
so i used the UserAddingRow event to open a MessageBox to ask the user if he wants to save.
If yes, all right.
If no, I use e.Cancel to reject the data.
=> At this point I would like the new Row to change back to the initial "Click here to add new row" state,
but it stays selected or defined as CurrentRow. The data is gone, but an empty row stays as long as I don't switch to
another row manually, even when the data bound to the grid changes.
I can't find a way to unselect the row or set CurrentRow = null, as it seems not to be possible out of the event.
Also there seems to be no other event to hook up to after UserAddingRow when cancelled.
Maybe there is an easy way of unselecting, or maybe I'm using the wrong event for that purpose.
I would be glad for some help. :)
01.private void RadGridViewClockTimeUserAddingRow(object sender, GridViewRowCancelEventArgs e)
02. {
03. var result = RadMessageBox.Show(
04. this,
05. Resources.DoYouWantToSaveNew,
06. Resources.Save,
07. MessageBoxButtons.OKCancel);
08.
09. if (result == DialogResult.OK) return;
10.
11. e.Cancel = true;
12. // CurrentRow = null ??
13. }
I recently upgraded the telerik controls from 2011.2.11.831 to 2015.1.331.20 and I am having an issue with the group by feature of the radgridview. Is this a known issue, and if is then is there a way to fix this?
grid1.png: The screen is stretched, the vertical scroll bar is clearly visible on the right.
grid2.png: As I reduce the width of the screen, the vertical scrollbar comes in with it as expected.
grid3.png: At this point the horizontal scroll bar is visible but the vertical one is not. This is with the horizontal scrollbar all the way to the right. Some content is also cut off.
grid4.png: This is how it looks before the telerik controls were updated to 2015.1.331.20.

I'm sure this question has been asked a 1000 times, but this will make 1001. I have a RadGridView and for the purposes of this discussion let make it a single column grid. I set the columntype to GridViewCommandColumn. Let's pretend I have 5 rows of data. On even numbered rows I DON'T want a button or any other editor/control. I just want a readonly bit of text to show (or no text at all for that matter). Basically, I want to change the even numbered rows/cells to a different cell type. In this case I want a readonly textbox or something similar. More generically, I want to know how to change individual cells at both design and runtime. Is this doable? If so, I could sure use some guidance.
Thanks ... Ed

I have a Windows application written in VB.Net. It has a RadDropDownList control that has Items added to it at Design time.
I would like to Filter the items in the RadDropDownList control or disable/enable some items in the RadDropDownList control depending on the data in the other controls on the WinForm.
I have tried looking at the documentation but it is not clear on how to filter the RadDropDownList or find some items to be enabled or disabled in the RadDropDownList when the control has items added at design time not at runtime.
I am using version 2015.3.1104.40 of the RadDropDownList.
Please help. Thanks!

I need to hide the "Editing & Proofing" and "Styles" group, achieved hide tab.
Sorry for my bad English
I'm going to fill my RadGridView by using multiple threads. My code is as follows but is not working. How can I do this?
BackgroundWorker[] workers = new BackgroundWorker[2]; private void frmTest_Load(object sender, EventArgs e) { for (int col = 0; col < 300; col++) grid.Columns.Add("Col " + col.ToString()); for (int r = 0; r < 2; r++) { workers[r] = new BackgroundWorker(); workers[r].DoWork += new DoWorkEventHandler(Worker_DoWork); workers[r].RunWorkerCompleted += new RunWorkerCompletedEventHandler(Worker_RunWorkerCompleted); workers[r].RunWorkerAsync(grid.MasterView); } } void Worker_DoWork(object sender, DoWorkEventArgs e) { var rnd = new Random(); var info = (GridViewInfo)e.Argument; var row = new GridViewDataRowInfo(info); int i = 0; foreach (GridViewCellInfo cell in row.Cells) { cell.Value = i++; cell.Style.NumberOfColors = 1; cell.Style.BackColor = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255)); cell.Style.CustomizeFill = true; } e.Result = row; } void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { grid.Rows.Add((GridViewDataRowInfo)e.Result); }
I am attempting to move multiple selected items between Telerik ListView controls. If I was doing this with a Winforms Listbox, it would look like this:
private void button1_Click(object sender, EventArgs e) { for(int x = listBox1.SelectedIndices.Count - 1; x>= 0; x--) { int idx = listBox1.SelectedIndices[x]; listBox2.Items.Add(listBox1.Items[idx]); listBox1.Items.RemoveAt(idx); } }
