This is a migrated thread and some comments may be shown as answers.

Trim Textbox In RadGrid(Edit Mode)

1 Answer 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aret
Top achievements
Rank 1
Aret asked on 14 Aug 2012, 04:06 PM
How would I go about trimming white space in a textbox inside a radgrid when it's in Edit Mode.  I want to trim any white space AFTER the string. 

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 16 Aug 2012, 05:44 AM
Hi,

Try the following code in ItemDataBound event to trim text in edit mode.
C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
 if (e.Item is GridEditableItem & e.Item.IsInEditMode)
 {
   GridEditableItem EditItem = (GridEditableItem)e.Item;
   TextBox txt = (TextBox)EditItem.FindControl("TextBox1");
   txt.Text.TrimEnd();
 }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Aret
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or