radgrid column alignment

2 posts, 0 answers
  1. Mehreen
    Mehreen avatar
    13 posts
    Member since:
    Mar 2014

    Posted 08 Jul 2015 Link to this post

    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,

  2. Eyup
    Admin
    Eyup avatar
    3694 posts

    Posted 13 Jul 2015 Link to this post

    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
Back to Top