or
if (gridCellElement != null){ if (gridCellElement.IsCurrent) { gridCellElement.IsCurrent = false; gridCellElement.IsCurrentColumn = false; } else { gridCellElement.ResetValue(LightVisualElement.DrawBorderProperty, ValueResetFlags.Local); gridCellElement.ResetValue(LightVisualElement.DrawFillProperty, ValueResetFlags.Local); }}aper
aaper
ape
per
pants per
aaa per
pants per
per
aaa per
aaper
ape
aper
per
aaa per
aaper
ape
aper
pants per
per
aaa per
aaper
aper
pants per
Imports Telerik.WinControls.UI Public Class Form7 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 RadListDataItem1 As Telerik.WinControls.UI.RadListDataItem = New Telerik.WinControls.UI.RadListDataItem() Dim RadListDataItem2 As Telerik.WinControls.UI.RadListDataItem = New Telerik.WinControls.UI.RadListDataItem() Dim RadListDataItem3 As Telerik.WinControls.UI.RadListDataItem = New Telerik.WinControls.UI.RadListDataItem() Dim RadListDataItem4 As Telerik.WinControls.UI.RadListDataItem = New Telerik.WinControls.UI.RadListDataItem() Dim RadListDataItem5 As Telerik.WinControls.UI.RadListDataItem = New Telerik.WinControls.UI.RadListDataItem() Dim RadListDataItem6 As Telerik.WinControls.UI.RadListDataItem = New Telerik.WinControls.UI.RadListDataItem() Me.RadDropDownList1 = New Telerik.WinControls.UI.RadDropDownList() CType(Me.RadDropDownList1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'RadDropDownList1 ' Me.RadDropDownList1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend Me.RadDropDownList1.DropDownAnimationEnabled = True RadListDataItem1.Text = "aper" RadListDataItem1.TextWrap = True RadListDataItem2.Text = "aaper" RadListDataItem2.TextWrap = True RadListDataItem3.Text = "ape" RadListDataItem3.TextWrap = True RadListDataItem4.Text = "per" RadListDataItem4.TextWrap = True RadListDataItem5.Text = "pants per" RadListDataItem5.TextWrap = True RadListDataItem6.Text = "aaa per" RadListDataItem6.TextWrap = True Me.RadDropDownList1.Items.Add(RadListDataItem1) Me.RadDropDownList1.Items.Add(RadListDataItem2) Me.RadDropDownList1.Items.Add(RadListDataItem3) Me.RadDropDownList1.Items.Add(RadListDataItem4) Me.RadDropDownList1.Items.Add(RadListDataItem5) Me.RadDropDownList1.Items.Add(RadListDataItem6) Me.RadDropDownList1.Location = New System.Drawing.Point(93, 126) Me.RadDropDownList1.Name = "RadDropDownList1" Me.RadDropDownList1.ShowImageInEditorArea = True Me.RadDropDownList1.Size = New System.Drawing.Size(106, 20) Me.RadDropDownList1.TabIndex = 1 Me.RadDropDownList1.ThemeName = "ControlDefault" ' 'Form7 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(292, 273) Me.Controls.Add(Me.RadDropDownList1) Me.Name = "Form7" Me.Text = "Form7" CType(Me.RadDropDownList1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents RadDropDownList1 As Telerik.WinControls.UI.RadDropDownList Public Class CustomAutoCompleteSuggestHelper Inherits AutoCompleteSuggestHelper Public Sub New(element As RadDropDownListElement) MyBase.New(element) End Sub Protected Overrides Function DefaultFilter(item As RadListDataItem) As Boolean Return item.Text.ToLower().Contains(Me.Filter.ToLower()) End Function Public Overrides Sub AutoComplete(e As KeyPressEventArgs) MyBase.AutoComplete(e) If Me.DropDownList.Items.Count > 0 Then 'Me.DropDownList.SelectedIndex = Me.DropDownList.FindString(Me.Filter) End If End Sub Private mFilter As String = String.Empty Protected Overrides ReadOnly Property Filter As String Get Return mFilter End Get End Property Public Overrides Sub ApplyFilterToDropDown(filter As String) Static filterFirstComparer As ListItemFilterAscendingComparer mFilter = filter If String.IsNullOrEmpty(filter) Then MyBase.ApplyFilterToDropDown(filter) Return End If With Me.DropDownList.ListElement .SelectionMode = SelectionMode.None .BeginUpdate() .Filter = Nothing .Filter = AddressOf DefaultFilter .SortStyle = Telerik.WinControls.Enumerations.SortStyle.Ascending End With ' will move all items that begin with the filter, to the top of the list If filterFirstComparer Is Nothing Then filterFirstComparer = New ListItemFilterAscendingComparer With {.filter = filter} Else filterFirstComparer.filter = filter End If Me.DropDownList.ListElement.ItemsSortComparer = filterFirstComparer Me.DropDownList.ListElement.EndUpdate() End Sub ''' <summary> ''' This class is used to compare data items when sorting in ascending order. ''' </summary> Private Class ListItemFilterAscendingComparer Implements System.Collections.Generic.IComparer(Of RadListDataItem) Public Property filter As String Public Overridable Function Compare(x As RadListDataItem, y As RadListDataItem) As Integer Implements System.Collections.Generic.IComparer(Of Telerik.WinControls.UI.RadListDataItem).Compare Dim ignoreCase = False If x.Owner IsNot Nothing Then ignoreCase = Not x.Owner.CaseSensitiveSort End If Dim xStart = x.Text.StartsWith(filter, System.StringComparison.InvariantCultureIgnoreCase) Dim yStart = y.Text.StartsWith(filter, System.StringComparison.InvariantCultureIgnoreCase) If xStart AndAlso Not yStart Then Return -1 ElseIf yStart AndAlso Not xStart Then Return 1 End If Return String.Compare(x.Text, y.Text, ignoreCase) End Function End Class End Class Private Sub Form7_Load(sender As Object, e As System.EventArgs) Handles Me.Load RadDropDownList1.AutoCompleteMode = Windows.Forms.AutoCompleteMode.SuggestAppend RadDropDownList1.DropDownListElement.AutoCompleteSuggest = New CustomAutoCompleteSuggestHelper(RadDropDownList1.DropDownListElement) End SubEnd Classif ("GridViewTextBoxColumn" == ((Telerik.WinControls.UI.GridDataCellElement)(sender)).GridControl.CurrentColumn.GetType().Name){ RadTextBoxEditor rtbe = ((Telerik.WinControls.UI.GridDataCellElement)(sender)).GridControl.ActiveEditor as RadTextBoxEditor; if (null != rtbe) { RadTextBoxEditorElement tbElement = (RadTextBoxEditorElement)rtbe.EditorElement; tbElement.Select(0, 0); }}Hi
I have tried change Microsoft combobox to Telerik new drop down list.
I have used this code to populate Microsoft combobox:
1.cbKlien.Items.Clear(); 2.var c =bS.view_Trans_Order_Custs.OrderBy(i => i.CustomerCode).Select( 4. i => new {i.CustomerCode, i.CompleteCustomerName}); 5. 6.cbKlien.Items.AddRange(c.ToArray()); 7.cbKlien.DisplayMember = "CustomerCode";It worked and was very fast.
But when I have added telerik drop down list I have can not populate using the some code :( I have received errors:
1.Error 1 The best overloaded method match for 'Telerik.WinControls.UI.RadListDataItemCollection.AddRange(System.Collections.Generic.IEnumerable<Telerik.WinControls.UI.RadListDataItem>)' has some invalid arguments c:\Users\PLRoStu\Documents\Visual Studio 2008\Projects\100924 ZlecTrans Test od Telerik\ZlecTransp001\fMain.cs 219 10 Zlecenia transportowe
1.Error 2 Argument '1': cannot convert from 'AnonymousType#1[]' to 'System.Collections.Generic.IEnumerable<Telerik.WinControls.UI.RadListDataItem>' c:\Users\PLRoStu\Documents\Visual Studio 2008\Projects\100924 ZlecTrans Test od Telerik\ZlecTransp001\fMain.cs 219 34 Zlecenia transportowe This error was on this line:
1.ddlKlien.Items.AddRange(c.ToArray());Of course I can populate using for but it very slow:
1.ddlKlien.Items.Clear(); 2. var c = dbS.view_Trans_Order_Custs.OrderBy(i => i.CustomerCode).Select( 3. i => new {i.CustomerCode, i.CompleteCustomerName}); 4. 5. for (int x = 0; x < c.ToArray().Length; x++) ddlKlien.Items.Add(c.ToArray()[x].CustomerCode); 6. //ddlKlien.Items.AddRange(c.ToArray()); 7. ddlKlien.DisplayMember = "CustomerCode";Could you help me correct my code for fast speed?
void AddItemToMultiColumnCombobox() { System.Data.OleDb.OleDbConnection con = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.IO.Path.GetFullPath("../../Database//Demo2.mdb")); con.Open(); OleDbCommand com = new OleDbCommand("select [tblICInventory].[strProductID] ,memDescription,dblUnitsInStock,dblUnitsAllocated,curSalesPrice,strWarehouseID from tblICInventory,tblICInventoryStockTotal where tblICInventory.strProductID = tblICInventoryStockTotal.strProductID ", con); OleDbDataAdapter oleda = new OleDbDataAdapter(); oleda.SelectCommand = com; DataSet ds = new DataSet(); oleda.Fill(ds); GridViewMultiComboBoxColumn col = new GridViewMultiComboBoxColumn(); col.DataSource = ds.Tables[0].DefaultView; col.DisplayMember = "tblICInventory.strProductID"; col.ValueMember = "tblICInventory.strProductID"; col.Width = 100; col.HeaderText = "Item No"; this.radGridViewDetail.Columns.RemoveAt(1); this.radGridViewDetail.Columns.Insert(1, col); col.AutoCompleteMode = AutoCompleteMode.None; col.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown; this.radGridViewDetail.CellBeginEdit += new GridViewCellCancelEventHandler(radGridViewDetail_CellBeginEdit); } bool isColumnAdded; void radGridViewDetail_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) { if (this.radGridViewDetail.CurrentColumn is GridViewMultiComboBoxColumn) { if (!isColumnAdded) { isColumnAdded = true; RadMultiColumnComboBoxElement editor = (RadMultiColumnComboBoxElement)this.radGridViewDetail.ActiveEditor; editor.EditorControl.MasterTemplate.AutoGenerateColumns = false; editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("tblICInventory.strProductID")); editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("memDescription")); editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("dblUnitsInStock")); editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("dblUnitsAllocated")); editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("curSalesPrice")); editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("strWarehouseID")); editor.EditorControl.Columns[0].HeaderText = "Item No"; editor.EditorControl.Columns[1].HeaderText = "Description"; editor.EditorControl.Columns[2].HeaderText = "Stock"; editor.EditorControl.Columns[3].HeaderText = "Available"; editor.EditorControl.Columns[4].HeaderText = "Price"; editor.EditorControl.Columns[5].HeaderText = "Warehouse"; editor.AutoSizeDropDownToBestFit = true; } } }