hi
I have a problem in multicolumnCombobox.
I set the dropdownStyle=DropDown .so when i do filtering, in some cases
when the filtering result is only one row ,this control sugests and appends the this row,but i dont want it to append the selected row ,i only want the suggestion .for example i want to write BubllBar ,when i start to writing and Write 'Bub' ,multicolumnCombobox do filtering and the filtering row is 'Bube' ,so it appends 'Bube' and then i must delete the 'e' and write 'BubllBar ' .please help me to solve this problem
private void Form1_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
radMultiColumnComboBox1.AutoFilter = true;
radMultiColumnComboBox1.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown;
dt.Columns.Add("Title", typeof(string));
dt.Rows.Add("Tom");
dt.Rows.Add("Bube");
dt.Rows.Add("emy");
dt.Rows.Add("Kate");
radMultiColumnComboBox1.DataSource = dt;
radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add("Title", FilterOperator.Contains, string.Empty);
}
I have a problem in multicolumnCombobox.
I set the dropdownStyle=DropDown .so when i do filtering, in some cases
when the filtering result is only one row ,this control sugests and appends the this row,but i dont want it to append the selected row ,i only want the suggestion .for example i want to write BubllBar ,when i start to writing and Write 'Bub' ,multicolumnCombobox do filtering and the filtering row is 'Bube' ,so it appends 'Bube' and then i must delete the 'e' and write 'BubllBar ' .please help me to solve this problem
private void Form1_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
radMultiColumnComboBox1.AutoFilter = true;
radMultiColumnComboBox1.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown;
dt.Columns.Add("Title", typeof(string));
dt.Rows.Add("Tom");
dt.Rows.Add("Bube");
dt.Rows.Add("emy");
dt.Rows.Add("Kate");
radMultiColumnComboBox1.DataSource = dt;
radMultiColumnComboBox1.EditorControl.FilterDescriptors.Add("Title", FilterOperator.Contains, string.Empty);
}
10 Answers, 1 is accepted
0
Hello Roya,
Svett
the Telerik team
We are aware of this limitation and will improve it in one of the next releases. I cannot provide you with a temporary solution due to complexity of the control. You can vote for the feature in our public issue tracking system.
All the best,Svett
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Roya
Top achievements
Rank 1
answered on 30 Apr 2012, 02:56 PM
Thank you Svett
I have another problem with multicolumncombobox ,some times 'Selected Value Change ' dosent happen.I dont Know Why!
for example I set the 'SelectedValue '=1 but the selected value doesnt change( while it contains '1' in the values).please help me to solve this problem.
I have another problem with multicolumncombobox ,some times 'Selected Value Change ' dosent happen.I dont Know Why!
for example I set the 'SelectedValue '=1 but the selected value doesnt change( while it contains '1' in the values).please help me to solve this problem.
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 30 Apr 2012, 03:54 PM
Hello Roya,
Please can you try the following sample. This should demonstrate the SelectedValueChanged event and being able to change the selected value programatically.
Designer File
Form 1.cs
Hope that helps
Richard
Please can you try the following sample. This should demonstrate the SelectedValueChanged event and being able to change the selected value programatically.
Designer File
namespace RadControlsWinFormsApp1{ partial class RadForm1 { /// <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() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RadForm1)); this.radMultiColumnComboBox1 = new Telerik.WinControls.UI.RadMultiColumnComboBox(); this.radButton1 = new Telerik.WinControls.UI.RadButton(); this.radButton2 = new Telerik.WinControls.UI.RadButton(); this.radButton3 = new Telerik.WinControls.UI.RadButton(); this.radButton4 = new Telerik.WinControls.UI.RadButton(); this.radButton5 = new Telerik.WinControls.UI.RadButton(); this.radButton6 = new Telerik.WinControls.UI.RadButton(); this.radLabel1 = new Telerik.WinControls.UI.RadLabel(); ((System.ComponentModel.ISupportInitialize)(this.radMultiColumnComboBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radLabel1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); this.SuspendLayout(); // // radMultiColumnComboBox1 // // // radMultiColumnComboBox1.NestedRadGridView // this.radMultiColumnComboBox1.EditorControl.BackColor = System.Drawing.SystemColors.Window; this.radMultiColumnComboBox1.EditorControl.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.radMultiColumnComboBox1.EditorControl.ForeColor = System.Drawing.SystemColors.ControlText; this.radMultiColumnComboBox1.EditorControl.Location = new System.Drawing.Point(0, 0); // // radMultiColumnComboBox1.NestedRadGridView // this.radMultiColumnComboBox1.EditorControl.MasterTemplate.AllowAddNewRow = false; this.radMultiColumnComboBox1.EditorControl.MasterTemplate.AllowCellContextMenu = false; this.radMultiColumnComboBox1.EditorControl.MasterTemplate.AllowColumnChooser = false; this.radMultiColumnComboBox1.EditorControl.MasterTemplate.EnableGrouping = false; this.radMultiColumnComboBox1.EditorControl.MasterTemplate.ShowFilteringRow = false; this.radMultiColumnComboBox1.EditorControl.Name = "NestedRadGridView"; this.radMultiColumnComboBox1.EditorControl.ReadOnly = true; this.radMultiColumnComboBox1.EditorControl.ShowGroupPanel = false; this.radMultiColumnComboBox1.EditorControl.Size = new System.Drawing.Size(240, 150); this.radMultiColumnComboBox1.EditorControl.TabIndex = 0; this.radMultiColumnComboBox1.Location = new System.Drawing.Point(12, 12); this.radMultiColumnComboBox1.Name = "radMultiColumnComboBox1"; // // // this.radMultiColumnComboBox1.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren; this.radMultiColumnComboBox1.Size = new System.Drawing.Size(204, 20); this.radMultiColumnComboBox1.TabIndex = 0; this.radMultiColumnComboBox1.TabStop = false; this.radMultiColumnComboBox1.Text = "radMultiColumnComboBox1"; // // radButton1 // this.radButton1.Location = new System.Drawing.Point(12, 47); this.radButton1.Name = "radButton1"; this.radButton1.Size = new System.Drawing.Size(29, 24); this.radButton1.TabIndex = 1; this.radButton1.Tag = resources.GetString("radButton1.Tag"); this.radButton1.Text = "1"; // // radButton2 // this.radButton2.Location = new System.Drawing.Point(47, 47); this.radButton2.Name = "radButton2"; this.radButton2.Size = new System.Drawing.Size(29, 24); this.radButton2.TabIndex = 2; this.radButton2.Tag = resources.GetString("radButton2.Tag"); this.radButton2.Text = "2"; // // radButton3 // this.radButton3.Location = new System.Drawing.Point(82, 47); this.radButton3.Name = "radButton3"; this.radButton3.Size = new System.Drawing.Size(29, 24); this.radButton3.TabIndex = 2; this.radButton3.Tag = resources.GetString("radButton3.Tag"); this.radButton3.Text = "3"; // // radButton4 // this.radButton4.Location = new System.Drawing.Point(117, 47); this.radButton4.Name = "radButton4"; this.radButton4.Size = new System.Drawing.Size(29, 24); this.radButton4.TabIndex = 2; this.radButton4.Tag = resources.GetString("radButton4.Tag"); this.radButton4.Text = "4"; // // radButton5 // this.radButton5.Location = new System.Drawing.Point(152, 47); this.radButton5.Name = "radButton5"; this.radButton5.Size = new System.Drawing.Size(29, 24); this.radButton5.TabIndex = 2; this.radButton5.Tag = resources.GetString("radButton5.Tag"); this.radButton5.Text = "5"; // // radButton6 // this.radButton6.Location = new System.Drawing.Point(187, 47); this.radButton6.Name = "radButton6"; this.radButton6.Size = new System.Drawing.Size(29, 24); this.radButton6.TabIndex = 2; this.radButton6.Tag = resources.GetString("radButton6.Tag"); this.radButton6.Text = "6"; // // radLabel1 // this.radLabel1.Location = new System.Drawing.Point(12, 90); this.radLabel1.Name = "radLabel1"; this.radLabel1.Size = new System.Drawing.Size(60, 16); this.radLabel1.TabIndex = 3; this.radLabel1.Text = "Selected..."; // // RadForm1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(227, 125); this.Controls.Add(this.radLabel1); this.Controls.Add(this.radButton6); this.Controls.Add(this.radButton5); this.Controls.Add(this.radButton4); this.Controls.Add(this.radButton3); this.Controls.Add(this.radButton2); this.Controls.Add(this.radButton1); this.Controls.Add(this.radMultiColumnComboBox1); this.Name = "RadForm1"; // // // this.RootElement.ApplyShapeToControl = true; this.Text = "RadForm1"; this.ThemeName = "ControlDefault"; ((System.ComponentModel.ISupportInitialize)(this.radMultiColumnComboBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton6)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radLabel1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private Telerik.WinControls.UI.RadMultiColumnComboBox radMultiColumnComboBox1; private Telerik.WinControls.UI.RadButton radButton1; private Telerik.WinControls.UI.RadButton radButton2; private Telerik.WinControls.UI.RadButton radButton3; private Telerik.WinControls.UI.RadButton radButton4; private Telerik.WinControls.UI.RadButton radButton5; private Telerik.WinControls.UI.RadButton radButton6; private Telerik.WinControls.UI.RadLabel radLabel1; }}Form 1.cs
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using Telerik.WinControls;using Telerik.WinControls.UI;using Telerik.WinControls.Primitives;namespace RadControlsWinFormsApp1{ public partial class RadForm1 : Telerik.WinControls.UI.RadForm { public RadForm1() { InitializeComponent(); List<User> users = new List<User>(); int i = 0; while (i <= 1000) { users.Add(new User(i, "User " + i.ToString())); i++; } this.radButton1.Click += new EventHandler(radButton_Click); this.radButton2.Click += new EventHandler(radButton_Click); this.radButton3.Click += new EventHandler(radButton_Click); this.radButton4.Click += new EventHandler(radButton_Click); this.radButton5.Click += new EventHandler(radButton_Click); this.radButton6.Click += new EventHandler(radButton_Click); this.radMultiColumnComboBox1.SelectedValueChanged += new EventHandler(radMultiColumnComboBox1_SelectedValueChanged); this.radMultiColumnComboBox1.DropDownStyle = RadDropDownStyle.DropDownList; this.radMultiColumnComboBox1.DataSource = users; this.radMultiColumnComboBox1.DisplayMember = "Name"; this.radMultiColumnComboBox1.ValueMember = "Id"; this.radMultiColumnComboBox1.SelectedValue = 1000; } void radMultiColumnComboBox1_SelectedValueChanged(object sender, EventArgs e) { this.radLabel1.Text = this.radMultiColumnComboBox1.SelectedValue.ToString(); } void radButton_Click(object sender, EventArgs e) { int i = Convert.ToInt16(((RadButton)sender).Text); this.radMultiColumnComboBox1.SelectedValue = i; } } public class User { public User(int id, string name) { Id = id; Name = name; } public User() { } public int Id { get; set; } public string Name { get; set; } }}Hope that helps
Richard
0
Roya
Top achievements
Rank 1
answered on 02 May 2012, 06:45 AM
Thank you Richard
I used your solution and it works.If i want to set SelectedValue=null (when i set the Text="" ,SelectedValue doesnt change to null )
,or if the ValueMember is charachter ,what should i do?
Ill be Thankfull if you could help me.
I used your solution and it works.If i want to set SelectedValue=null (when i set the Text="" ,SelectedValue doesnt change to null )
,or if the ValueMember is charachter ,what should i do?
Ill be Thankfull if you could help me.
0
Richard Slade
Top achievements
Rank 2
answered on 02 May 2012, 10:02 AM
Hello,
Here is an updated sample that covers your scenario of dealing with null values
Designer File
Form
Hope that helps
Richard
Here is an updated sample that covers your scenario of dealing with null values
Designer File
namespace RadControlsWinFormsApp1{ partial class RadForm1 { /// <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.radMultiColumnComboBox1 = new Telerik.WinControls.UI.RadMultiColumnComboBox(); this.radButton1 = new Telerik.WinControls.UI.RadButton(); this.radButton2 = new Telerik.WinControls.UI.RadButton(); this.radButton3 = new Telerik.WinControls.UI.RadButton(); this.radButton4 = new Telerik.WinControls.UI.RadButton(); this.radButton5 = new Telerik.WinControls.UI.RadButton(); this.radButton6 = new Telerik.WinControls.UI.RadButton(); this.radLabel1 = new Telerik.WinControls.UI.RadLabel(); this.radButton7 = new Telerik.WinControls.UI.RadButton(); ((System.ComponentModel.ISupportInitialize)(this.radMultiColumnComboBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton5)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radLabel1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton7)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this)).BeginInit(); this.SuspendLayout(); // // radMultiColumnComboBox1 // // // radMultiColumnComboBox1.NestedRadGridView // this.radMultiColumnComboBox1.EditorControl.BackColor = System.Drawing.SystemColors.Window; this.radMultiColumnComboBox1.EditorControl.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.radMultiColumnComboBox1.EditorControl.ForeColor = System.Drawing.SystemColors.ControlText; this.radMultiColumnComboBox1.EditorControl.Location = new System.Drawing.Point(0, 0); // // radMultiColumnComboBox1.NestedRadGridView // this.radMultiColumnComboBox1.EditorControl.MasterTemplate.AllowAddNewRow = false; this.radMultiColumnComboBox1.EditorControl.MasterTemplate.AllowCellContextMenu = false; this.radMultiColumnComboBox1.EditorControl.MasterTemplate.AllowColumnChooser = false; this.radMultiColumnComboBox1.EditorControl.MasterTemplate.EnableGrouping = false; this.radMultiColumnComboBox1.EditorControl.MasterTemplate.ShowFilteringRow = false; this.radMultiColumnComboBox1.EditorControl.Name = "NestedRadGridView"; this.radMultiColumnComboBox1.EditorControl.ReadOnly = true; this.radMultiColumnComboBox1.EditorControl.ShowGroupPanel = false; this.radMultiColumnComboBox1.EditorControl.Size = new System.Drawing.Size(240, 150); this.radMultiColumnComboBox1.EditorControl.TabIndex = 0; this.radMultiColumnComboBox1.Location = new System.Drawing.Point(12, 12); this.radMultiColumnComboBox1.Name = "radMultiColumnComboBox1"; // // // this.radMultiColumnComboBox1.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren; this.radMultiColumnComboBox1.Size = new System.Drawing.Size(204, 20); this.radMultiColumnComboBox1.TabIndex = 0; this.radMultiColumnComboBox1.TabStop = false; this.radMultiColumnComboBox1.Text = "radMultiColumnComboBox1"; // // radButton1 // this.radButton1.Location = new System.Drawing.Point(46, 38); this.radButton1.Name = "radButton1"; this.radButton1.Size = new System.Drawing.Size(29, 24); this.radButton1.TabIndex = 1; this.radButton1.Text = "1"; // // radButton2 // this.radButton2.Location = new System.Drawing.Point(81, 38); this.radButton2.Name = "radButton2"; this.radButton2.Size = new System.Drawing.Size(29, 24); this.radButton2.TabIndex = 2; this.radButton2.Text = "2"; // // radButton3 // this.radButton3.Location = new System.Drawing.Point(116, 38); this.radButton3.Name = "radButton3"; this.radButton3.Size = new System.Drawing.Size(29, 24); this.radButton3.TabIndex = 2; this.radButton3.Text = "3"; // // radButton4 // this.radButton4.Location = new System.Drawing.Point(151, 38); this.radButton4.Name = "radButton4"; this.radButton4.Size = new System.Drawing.Size(29, 24); this.radButton4.TabIndex = 2; this.radButton4.Text = "4"; // // radButton5 // this.radButton5.Location = new System.Drawing.Point(186, 38); this.radButton5.Name = "radButton5"; this.radButton5.Size = new System.Drawing.Size(29, 24); this.radButton5.TabIndex = 2; this.radButton5.Text = "5"; // // radButton6 // this.radButton6.Location = new System.Drawing.Point(221, 38); this.radButton6.Name = "radButton6"; this.radButton6.Size = new System.Drawing.Size(29, 24); this.radButton6.TabIndex = 2; this.radButton6.Text = "6"; // // radLabel1 // this.radLabel1.Location = new System.Drawing.Point(12, 90); this.radLabel1.Name = "radLabel1"; this.radLabel1.Size = new System.Drawing.Size(56, 18); this.radLabel1.TabIndex = 3; this.radLabel1.Text = "Selected..."; // // radButton7 // this.radButton7.Location = new System.Drawing.Point(11, 38); this.radButton7.Name = "radButton7"; this.radButton7.Size = new System.Drawing.Size(29, 24); this.radButton7.TabIndex = 2; this.radButton7.Text = "null"; // // RadForm1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(256, 125); this.Controls.Add(this.radButton7); this.Controls.Add(this.radLabel1); this.Controls.Add(this.radButton6); this.Controls.Add(this.radButton5); this.Controls.Add(this.radButton4); this.Controls.Add(this.radButton3); this.Controls.Add(this.radButton2); this.Controls.Add(this.radButton1); this.Controls.Add(this.radMultiColumnComboBox1); this.Name = "RadForm1"; // // // this.RootElement.ApplyShapeToControl = true; this.Text = "RadForm1"; this.ThemeName = "ControlDefault"; ((System.ComponentModel.ISupportInitialize)(this.radMultiColumnComboBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton5)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton6)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radLabel1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.radButton7)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private Telerik.WinControls.UI.RadMultiColumnComboBox radMultiColumnComboBox1; private Telerik.WinControls.UI.RadButton radButton1; private Telerik.WinControls.UI.RadButton radButton2; private Telerik.WinControls.UI.RadButton radButton3; private Telerik.WinControls.UI.RadButton radButton4; private Telerik.WinControls.UI.RadButton radButton5; private Telerik.WinControls.UI.RadButton radButton6; private Telerik.WinControls.UI.RadLabel radLabel1; private Telerik.WinControls.UI.RadButton radButton7; }}Form
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using Telerik.WinControls;using Telerik.WinControls.UI;using Telerik.WinControls.Primitives;namespace RadControlsWinFormsApp1{ public partial class RadForm1 : Telerik.WinControls.UI.RadForm { public RadForm1() { InitializeComponent(); List<User> users = new List<User>(); users.Add(new User(null, "")); int i = 0; while (i <= 1000) { users.Add(new User(i, "User " + i.ToString())); i++; } this.radButton1.Click += new EventHandler(radButton_Click); this.radButton2.Click += new EventHandler(radButton_Click); this.radButton3.Click += new EventHandler(radButton_Click); this.radButton4.Click += new EventHandler(radButton_Click); this.radButton5.Click += new EventHandler(radButton_Click); this.radButton6.Click += new EventHandler(radButton_Click); this.radButton7.Click += new EventHandler(radButton_Click); // null this.radMultiColumnComboBox1.SelectedValueChanged += new EventHandler(radMultiColumnComboBox1_SelectedValueChanged); this.radMultiColumnComboBox1.DropDownStyle = RadDropDownStyle.DropDownList; this.radMultiColumnComboBox1.DataSource = users; this.radMultiColumnComboBox1.DisplayMember = "Name"; this.radMultiColumnComboBox1.ValueMember = "Id"; this.radMultiColumnComboBox1.NullText = "Null Text"; this.radMultiColumnComboBox1.SelectedValue = 1000; } void radMultiColumnComboBox1_SelectedValueChanged(object sender, EventArgs e) { this.radLabel1.Text = this.radMultiColumnComboBox1.Text; } void radButton_Click(object sender, EventArgs e) { string buttonText = ((RadButton)sender).Text; if (buttonText == "null") { buttonText = null; } int? i; if (buttonText == null) { i = null; } else { i = Convert.ToInt16(buttonText); } foreach (GridViewDataRowInfo row in this.radMultiColumnComboBox1.EditorControl.ChildRows) { if (((int?)row.Cells["Id"].Value) == i) { row.IsCurrent = true; row.IsSelected = true; return; } } } } public class User { public User(int? id, string name) { Id = id; Name = name; } public User() { } public int? Id { get; set; } public string Name { get; set; } }}Hope that helps
Richard
0
Roya
Top achievements
Rank 1
answered on 02 May 2012, 02:30 PM
Thank you Richard
i use your code but it doesnt work ,the selectedvalue doesnt change to null
i use your code but it doesnt work ,the selectedvalue doesnt change to null
0
Richard Slade
Top achievements
Rank 2
answered on 02 May 2012, 02:33 PM
Roya,
The selected value will not be null, but you will see that the item selected is the one that has a null value.
Hope that helps
Richard
The selected value will not be null, but you will see that the item selected is the one that has a null value.
Hope that helps
Richard
0
Roya
Top achievements
Rank 1
answered on 02 May 2012, 02:49 PM
Thank you Richard for your reply
but i need to set the selectedvalue =null;
for example when the DropDownStyle is set to RadDropDownStyle.DropDown,when i clear the selected text ,i want to set the selected value=null if it doesnt change to null,the selected value shows the previous value which was selected
but i need to set the selectedvalue =null;
for example when the DropDownStyle is set to RadDropDownStyle.DropDown,when i clear the selected text ,i want to set the selected value=null if it doesnt change to null,the selected value shows the previous value which was selected
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 02 May 2012, 03:48 PM
Hello Roya,
If you have it set to
then clearing the text does not change the SelectedValue. As you can see the text of the RadMultiColumnComboBox is blank, but the EditorControl (RadGridView) will still have a selected value.
The following change to the sample shows a SelectedValue = null exmaple
Please remember to mark as answer if this helps
Thanks
Richard
If you have it set to
this.radMultiColumnComboBox1.DropDownStyle = RadDropDownStyle.DropDown;The following change to the sample shows a SelectedValue = null exmaple
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using Telerik.WinControls;using Telerik.WinControls.UI;using Telerik.WinControls.Primitives;namespace RadControlsWinFormsApp1{ public partial class RadForm1 : Telerik.WinControls.UI.RadForm { public RadForm1() { InitializeComponent(); List<User> users = new List<User>(); users.Add(new User(null, "")); int i = 0; while (i <= 1000) { users.Add(new User(i, "User " + i.ToString())); i++; } this.radButton1.Click += new EventHandler(radButton_Click); this.radButton2.Click += new EventHandler(radButton_Click); this.radButton3.Click += new EventHandler(radButton_Click); this.radButton4.Click += new EventHandler(radButton_Click); this.radButton5.Click += new EventHandler(radButton_Click); this.radButton6.Click += new EventHandler(radButton_Click); this.radButton7.Click += new EventHandler(radButton_Click); // null this.radMultiColumnComboBox1.SelectedValueChanged += new EventHandler(radMultiColumnComboBox1_SelectedValueChanged); this.radMultiColumnComboBox1.DropDownStyle = RadDropDownStyle.DropDown; this.radMultiColumnComboBox1.DataSource = users; this.radMultiColumnComboBox1.DisplayMember = "Name"; this.radMultiColumnComboBox1.ValueMember = "Id"; this.radMultiColumnComboBox1.NullText = "Null Text"; this.radMultiColumnComboBox1.SelectedValue = 1000; this.radMultiColumnComboBox1.TextChanged += new EventHandler(radMultiColumnComboBox1_TextChanged); } void radMultiColumnComboBox1_TextChanged(object sender, EventArgs e) { if (this.radMultiColumnComboBox1.Text == null | this.radMultiColumnComboBox1.Text.Length == 0) { this.radMultiColumnComboBox1.EditorControl.CurrentRow = null; this.radMultiColumnComboBox1.EditorControl.ClearSelection(); } } void radMultiColumnComboBox1_SelectedValueChanged(object sender, EventArgs e) { if (this.radMultiColumnComboBox1.SelectedValue == null) { this.radLabel1.Text = "Selected Value Is NULL"; } else { this.radLabel1.Text = this.radMultiColumnComboBox1.Text; } } void radButton_Click(object sender, EventArgs e) { string buttonText = ((RadButton)sender).Text; if (buttonText == "null") { buttonText = null; } int? i; if (buttonText == null) { i = null; } else { i = Convert.ToInt16(buttonText); } foreach (GridViewDataRowInfo row in this.radMultiColumnComboBox1.EditorControl.ChildRows) { if (((int?)row.Cells["Id"].Value) == i) { row.IsCurrent = true; row.IsSelected = true; return; } } } } public class User { public User(int? id, string name) { Id = id; Name = name; } public User() { } public int? Id { get; set; } public string Name { get; set; } }}Please remember to mark as answer if this helps
Thanks
Richard
0
Roya
Top achievements
Rank 1
answered on 03 May 2012, 07:05 AM
thank you Richard .you add a null row to data table and it solve my problem