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

Length of text in GridBoundColumn

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vlastimil
Top achievements
Rank 1
Vlastimil asked on 01 Nov 2008, 08:33 PM
Hallo,
may be it's easy problem, but I don't know, how to solve it.
I have rad grid with  columns and displayed data have string format(and it is long text ). And I need to  display for example only first ten charakters of text ( in GridBoundColumn). 
Is there any possibility  how to do it?
Thanks for answer
Vlasta

 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Nov 2008, 04:44 AM
Hi,

Try the following code snippet to achieve the desired scenario.

CS:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            if (item["UniqueName"].Text.Length > 10) 
            { 
                item["UniqueName"].Text = item["UniqueName"].Text.Remove(10); 
            } 
        } 
    } 


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