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

radgrid column alignment

1 Answer 145 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mehreen
Top achievements
Rank 1
Mehreen asked on 08 Jul 2015, 07:33 PM

I have a column in the grid which returns multiple data vertically. How can I display the content horizontally?

i.e. my column displays:

AB

CD

EF

 

but I need to display: AB, CD,EF

this is my code:

<telerik:GridBoundColumn DataField="Specialty" HeaderText="Specialty" SortExpression="Specialty" ItemStyle-Width="9%"
HeaderStyle-Width="9%" UniqueName="Specialty"
FilterControlWidth="30px" ItemStyle-HorizontalAlign="Left" FilterControlToolTip="Search by Specialty" AutoPostBackOnFilter="true"
FooterText="Total Credits: " FooterStyle-HorizontalAlign="Right" FooterStyle-Font-Bold="true" FilterImageToolTip="Search by Specialty" HeaderTooltip="Sort by Specialty" >
</telerik:GridBoundColumn>

Thanks,

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 13 Jul 2015, 11:10 AM
Hi Mehreen,

You can access the cell on ItemDataBound and modify the value accordingly:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = e.Item as GridDataItem;
        item["ShipCountry"].Text = item["ShipCountry"].Text.Replace("<br/>", "")
          .Replace(Environment.NewLine, "");
    }
}

Alternatively, you can use a GridTemplateColumn with a Label inside its ItemTemplate and set whatever value you want.

Hope this helps.

Regards,
Eyup
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
Mehreen
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or