Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Elegant Grid Tech Support » CellCustomEditor quetion Collapse All
Subject Author Date
John Pag Jul 21, 2010 - 5:59 AM

 


i create this class


 TextCellCustomEditor : TextBox, ICellEditor
{
   base.MaxLength = 20;
  //some code
}



and after i create column


 TextCellStyle myTextCell = new TextCellStyle();
 myTextCell.CustomEditorType = typeof(TextCellCustomEditor);
 myTextCell.TextAlignment = ContentAlignment.MiddleLeft;

 myColumns[0] = new Column();
 myColumns[0].DataPropertyName = "1";
 myColumns[0].Visible = true;
 myColumns[0].CellType = typeof(TextCell);
 myColumns[0].CellStyles.AddRange(new Elegant.Ui.Grid.CellStyle[] { myTextCell });
 myColumns[0].HeaderText = "Text cells";



it’s work ok but i need change  MaxLength programmatically. How i can do it?

How i can change this variable when i create column and how i can change this variable in runtime?

John Pag Jul 23, 2010 - 12:54 AM

MaxLenght is not the width of column but total of characters that it can import the user. For TextBox.MaxLenght = the 10 user can put only 10 characters in the field. This I want to achieve.

Technical Support Aug 5, 2010 - 9:07 AM

Each time your custom editor is activated you can set MaxLength to a specified value.

Technical Support Jul 22, 2010 - 8:12 AM

Please use the Column.Width property. Alternatively you can use the Column.MinimumWidth to make sure that column won’t become smaller in auto-size mode.

John Pag Jul 22, 2010 - 7:54 AM

i want that each column to have its own maxlength. i need to initialize the maxlength for each column during its creation.... or to change the maxlength in runtime.


For example, i want to enter the length in the textbox (not in the grid)  and after pressing enter i want to set the length for the sellected column, i didnt find how to make it.


 


 


 

Technical Support Jul 22, 2010 - 5:23 AM

The activated editor receives a reference to a Cell object in Activate method. Using the Cell object you can get the column containing this cell and dynamically calculate the width of an editor.