Edit this page

GridViewTextBoxColumn

GridViewTextBoxColumn displays and allows editing of text data. Each cell in GridViewTextBoxColumn column displays the text of cell Value property according to the settings of the TextAlignment (default is ContentAlignment.MiddleLeft) and WrapText(default is false) properties. The displayed text is formatted according to the value of the FormatString property.

When a user begins editing a cell, a textbox editor is provided to handle the user’s input. The length of the text the user can enter is restricted to the value of MaxLength property.

gridview-columns-gridviewtextboxcolumn 001

Add GridViewTextBoxColumn to the grid.

GridViewTextBoxColumn textBoxColumn = new GridViewTextBoxColumn();
textBoxColumn.Name = "TextBoxColumn";
textBoxColumn.HeaderText = "Product Name";
textBoxColumn.FieldName = "ProductName";
textBoxColumn.MaxLength = 50;
textBoxColumn.TextAlignment = ContentAlignment.BottomRight;
radGridView1.MasterTemplate.Columns.Add(textBoxColumn);

Dim textBoxColumn As New GridViewTextBoxColumn()
textBoxColumn.Name = "TextBoxColumn"
textBoxColumn.HeaderText = "Product Name"
textBoxColumn.FieldName = "ProductName"
textBoxColumn.MaxLength = 50
textBoxColumn.TextAlignment = ContentAlignment.BottomRight
RadGridView1.MasterTemplate.Columns.Add(textBoxColumn)

Character casing

GridViewTextBoxColumn editor - RadTextBoxEditor - supports character casing. To enable this functionality you need to set ColumnCharecterCasing property of the desired GridViewTextBoxColumn column:

((GridViewTextBoxColumn)this.radGridView1.Columns[0]).ColumnCharacterCasing = CharacterCasing.Upper;

DirectCast(Me.RadGridView1.Columns(0), GridViewTextBoxColumn).ColumnCharacterCasing = CharacterCasing.Upper

note

ColumnCarecterCasing property affects only the editor and does not change the values in your data base. For instance, if your data base contains text which is lower case or partially lower case and you set the ColumnCharecterCasing to upper case the data will not be change, but if the user starts editing a cell, the editor will only allow upper case symbols and all lower case symbols will be converted to upper case ones.

See Also