or
Private Sub RadAutoCompleteBox_CreateTextBlock(sender As Object, e As CreateTextBlockEventArgs) If TypeOf e.TextBlock Is TokenizedTextBlockElement Then For Each item As RadListDataItem In RadAutoCompleteBox1.AutoCompleteItems If item.Text.ToLower = e.Text.ToLower Then e.TextBlock = New TokenizedTextBlockElement(item.Text) Exit For End If Next End IfEnd Subpublic class MyObject{ public long Id {get; set;} public string Name {get; set;} public string Code {get; set;} public MyObject Parent {get;set;}}GridViewTextBoxColumn col1 = new GridViewTextBoxColumn("Id", "Id");GridViewTextBoxColumn col2 = new GridViewTextBoxColumn("ParentId", "Parent.Id");grid.MasterTemplate.Columns.Add(col1);grid.MasterTemplate.Columns.Add(col2); grid.Columns["Id"].IsVisible = false;grid.Columns["ParentId"].IsVisible = false;grid.Relations.AddSelfReference(grid.MasterTemplate, "Id", "ParentId");private void Populate(IList<MyObject> dataToPopulate) { this.grid.BeginUpdate(); var relationsBackup = this.grid.Relations.ToList(); this.grid.Relations.Clear(); this.grid.DataSource = dataToPopulate; this.grid.Relations.AddRange(relationsBackup); this.grid.EndUpdate(); this.grid.MasterView.Refresh(); }public static class GridUtils{ public static GridViewMaskBoxColumn AddPhoneNumberColumn(this RadGridView grid, string uniqueName, string fieldName, string headerText, Type type) { GridViewMaskBoxColumn col = new GridViewMaskBoxColumn(); col.Name = uniqueName; col.FieldName = fieldName; col.HeaderText = headerText; col.MaskType = MaskType.Standard; col.Mask = "(000) 000-0000"; col.FormatString = "{0:(###) ###-####}"; col.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; col.DataType = type; grid.Columns.Add(col); return col; }}public class Form2 : Form{ private BindingList<TestClass> _dataSource; public class TestClass { private string _string; private double? _double; public string PhoneString { get { return this._string; } set { this._string = value; } } public double? PhoneDouble { get { return this._double; } set { this._double = value; } } } public Form2() { InitializeComponent(); this.radGridView1.AutoGenerateColumns = false; this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; this.radGridView1.AddPhoneNumberColumn("stringMasked", "PhoneString", "PhoneStringMasked", typeof(string)); this.radGridView1.AddPhoneNumberColumn("doubleMasked", "PhoneDouble", "PhoneDoubleMasked", typeof(double?)); this._dataSource = new BindingList<TestClass>(); this._dataSource.Add(new TestClass() { PhoneDouble = 5554443333, PhoneString = "5554443333" }); this.radGridView1.DataSource = this._dataSource; } #region Designer /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #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() { this.radGridView1 = new Telerik.WinControls.UI.RadGridView(); ((System.ComponentModel.ISupportInitialize)(this.radGridView1)).BeginInit(); this.SuspendLayout(); // // radGridView1 // this.radGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.radGridView1.Location = new System.Drawing.Point(0, 0); this.radGridView1.Name = "radGridView1"; this.radGridView1.Size = new System.Drawing.Size(607, 284); this.radGridView1.TabIndex = 0; this.radGridView1.Text = "radGridView1"; // // Form2 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(607, 284); this.Controls.Add(this.radGridView1); this.Name = "Form2"; this.Text = "Form2"; ((System.ComponentModel.ISupportInitialize)(this.radGridView1)).EndInit(); this.ResumeLayout(false); } private Telerik.WinControls.UI.RadGridView radGridView1; #endregion #endregion}Dim tGrid As New RadGridViewtGrid = grdItemtGrid.Columns.Remove("cart")PrintReport(tGrid, rptname & " Report")
private void cmbUsers_SelectedValueChanged(object sender, EventArgs e) { cmbUsers.ValueMember = "Id"; var resguardos = from e1 in context.tblBienes where e1.IdResponsable == (long)cmbUsuarios.SelectedValue select new { Id = e1.IdBien, Descripcion = e1.descripcion, Estado = e1.estado, Placa_Anterior = e1.placaAnterior, Placa_Nueva = e1.placaNueva, Ubicacion = e1.ubicacion, Fecha_De_Asignacion = e1.fechaAsignacion, Etiqueta = e1.etiqueta, Procuraduria = context.tblProcuradurias.Where(e2 => (e2.IdProcuraduria == (long)cmbProcuradurias.SelectedValue)).Select((e2 => e2.ciudad)).FirstOrDefault() }; rgvResguardos.DataSource = resguardos; }public class DummyModel { public string Stringtest { get; set; } public char Chartest { get; set; } }