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

String format issue in RadGrid

1 Answer 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shrujan
Top achievements
Rank 1
Shrujan asked on 08 Jul 2015, 08:08 AM

Hi Team,

 While i'm trying to bind the string data to the Rad Grid it is not binding exact value which i have pulled from Data Base.

For Example i'm pulling the Data    : -   "A     BC         E F G"      and binding the same data to the Rad Grid, the problem here is the rad grid column is trimming out all the spaces and displaying like     :-  "A BC EFG"    

Here i need to bind the exact data which i'm pulling from Database.

Could you please help me out from this issue.

 

Thanks in Advance

A.Shrujan

 

 

 

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 13 Jul 2015, 06:30 AM
Hello Shrujan,

The white spaces are removed by the browser and in order to keep them you have to replace the white spaces with  . Please check out the following code snippet which demonstrates how to achieve that.
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = e.Item as GridDataItem;
        item["Column1"].Text = item["Column1"].Text.Replace(" ", " ");
    }
}


Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Shrujan
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or