Edward Chen
Top achievements
Rank 1
Edward Chen
asked on 25 Jan 2011, 08:03 PM
Hi,
After attaching a datasource to a radgridview , I apply best fit on the entire grid. But sometimes my grid behaves wierd and gives me something like the attached image. Please help.
Thanks a lot
Shweta
After attaching a datasource to a radgridview , I apply best fit on the entire grid. But sometimes my grid behaves wierd and gives me something like the attached image. Please help.
Thanks a lot
Shweta
2 Answers, 1 is accepted
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 25 Jan 2011, 09:41 PM
Hello Edward,
Please could you give some further details on your error. For exmaple, any special grid settings that you are using, such as AutoSizeRows etc.. and if you can post a small sample that replicates the issue, then that would also help
In the meantime, here is a sample that you can try in a new project. Please let me know if this works fine for you.
Thanks
Richard
Designer File
form1.vb
Please could you give some further details on your error. For exmaple, any special grid settings that you are using, such as AutoSizeRows etc.. and if you can post a small sample that replicates the issue, then that would also help
In the meantime, here is a sample that you can try in a new project. Please let me know if this works fine for you.
Thanks
Richard
Designer File
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class GenericItemListForm Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Dim SortDescriptor1 As Telerik.WinControls.Data.SortDescriptor = New Telerik.WinControls.Data.SortDescriptor() Me.RadGridView1 = New Telerik.WinControls.UI.RadGridView() CType(Me.RadGridView1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'RadGridView1 ' Me.RadGridView1.BackColor = System.Drawing.SystemColors.Control Me.RadGridView1.Cursor = System.Windows.Forms.Cursors.Default Me.RadGridView1.Dock = System.Windows.Forms.DockStyle.Fill Me.RadGridView1.Font = New System.Drawing.Font("Segoe UI", 8.25!) Me.RadGridView1.ForeColor = System.Drawing.SystemColors.ControlText Me.RadGridView1.ImeMode = System.Windows.Forms.ImeMode.NoControl Me.RadGridView1.Location = New System.Drawing.Point(0, 0) ' 'RadGridView1 ' Me.RadGridView1.MasterTemplate.EnableAlternatingRowColor = True Me.RadGridView1.MasterTemplate.ShowRowHeaderColumn = False SortDescriptor1.Direction = System.ComponentModel.ListSortDirection.Descending SortDescriptor1.PropertyName = "DateStamp" Me.RadGridView1.MasterTemplate.SortDescriptors.AddRange(New Telerik.WinControls.Data.SortDescriptor() {SortDescriptor1}) Me.RadGridView1.Name = "RadGridView1" Me.RadGridView1.Padding = New System.Windows.Forms.Padding(0, 0, 0, 1) Me.RadGridView1.RightToLeft = System.Windows.Forms.RightToLeft.No ' ' ' Me.RadGridView1.RootElement.Padding = New System.Windows.Forms.Padding(0, 0, 0, 1) Me.RadGridView1.Size = New System.Drawing.Size(874, 443) Me.RadGridView1.TabIndex = 0 Me.RadGridView1.Text = "RadGridView1" ' 'GenericItemListForm ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(874, 443) Me.Controls.Add(Me.RadGridView1) Me.Name = "GenericItemListForm" Me.Text = "PendingItems" CType(Me.RadGridView1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub Friend WithEvents RadGridView1 As Telerik.WinControls.UI.RadGridView 'Friend WithEvents BaseItemsBindingSource As System.Windows.Forms.BindingSource End Classform1.vb
Imports Telerik.WinControls.UI Imports System.Text Imports Telerik.WinControls.Data Imports Telerik.WinControls.UI.Export Imports System.ComponentModel Public Class GenericItemListForm Public Sub New() InitializeComponent() RadGridView1.AutoSizeRows = False RadGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None RadGridView1.AutoGenerateColumns = True Dim myList As New BindingList(Of MyObject) For i As Integer = 0 To 20 Dim item As New MyObject("Name " & i.ToString(), "A text description " & i.ToString(), i) myList.Add(item) Next Me.RadGridView1.DataSource = myList End Sub Private Sub RadGridView1_DataBindingComplete(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.GridViewBindingCompleteEventArgs) Handles RadGridView1.DataBindingComplete Me.RadGridView1.BestFitColumns() End SubEnd Class Public Class MyObject Public Sub New(ByVal name As String, ByVal description As String, ByVal id As Integer) Me.Name = name Me.Description = description Me.Id = id End Sub Public Property Name As String Public Property Description As String Public Property Id As Integer End Class0
Edward Chen
Top achievements
Rank 1
answered on 26 Jan 2011, 01:48 AM
Thanks a lot . I will give it a try.