Datagridviewcolumn & Custom Property
-
Hi all, can anyone tell me why my(Test) custom property is value can not be stored. Its always null.Its displaying in property window and getting user input. Thanks in advance.. using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.ComponentModel; namespace EMS.NET { [ToolboxItem(false)] public class JTextBoxColumn : System.Windows.Forms.DataGridViewColumn { public JTextBoxColumn(): base(new JTextBoxCell()) { } private String mTest; [TypeConverter(typeof(StringConverter))] [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public String Test { get { return mTest; } set { mTest = value; } } public override DataGridViewCell CellTemplate { get { return base.CellTemplate; } set { if (value != null && !value.GetType().IsAssignableFrom(typeof(JTextBoxCell))) { throw new InvalidCastException("Must be a Text Box Cell"); } base.CellTemplate = value; } } } [ToolboxItem(false)] public class JTextBoxCell : DataGridViewTextBoxCell { public JTextBoxCell() : base() { } private String mTest; public String Test { get { return mTest; } set { mTest = value; } } public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) { base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle); JTextBoxEditingControl ctl = DataGridView.EditingControl as JTextBoxEditingControl; ctl.Dock = DockStyle.Fill; if (this.Value == null || this.Value.ToString() == System.DBNull.Value.ToString()) ctl.Text = "Null"; else ctl.Text = this.Value.ToString(); } public override Type EditType { get { // Return the type of the editing contol that CalendarCell uses. return typeof(JTextBoxEditingControl); } } public override string T