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

Align two items inside RadGrid column

1 Answer 208 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 16 Jun 2014, 08:09 PM
What I am trying to do is align one item to the right and the other to the left side of the column.

Inside the column is an up and down arrow. The up arrow should be on the left while the down arrow is on the right.

The reason I need to align them is because if I remove the up arrow for the first section(because it can't go higher than first) the down arrow then is on the left, being in-line with the other up arrows, and vice-versa.

These two buttons are ImageButtons inside a single GridTemplateColumn. Looks like this:

<telerik:GridTemplateColumn AllowFiltering="false">
                                <ItemTemplate>
                                    <asp:ImageButton ID="btnUp" runat="server" CommandName="moveup" ImageUrl="~/images/up.gif"/>
                                    <asp:ImageButton ID="btnDn" runat="server" CommandName="movedn" ImageUrl="~/images/dn.gif"/>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>

I do not want to align the whole row either. Just the column/buttons.

I could however just align the column to be center, but I would rather have the buttons be in-line with the similar buttons.

I tried attaching an ID to the TemplateColumn, but there is no ID method. Also attempted a HorizontalAlign on the ImageButtons, but there isn't a method there either.

Is there currently a way to do this? Or am I being too picky.

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 18 Jun 2014, 04:47 AM
Hi Alexander,

Please try setting CssClass for the ImageButton and set the css float Property as follows.

ASPX:
<telerik:GridTemplateColumn AllowFiltering="false">
    <ItemTemplate>
        <asp:ImageButton ID="btnUp" runat="server" CommandName="moveup" ImageUrl="~/images/up.gif" />
        <asp:ImageButton ID="btnDn" runat="server" CssClass="right" CommandName="movedn" ImageUrl="~/images/dn.gif" />
    </ItemTemplate>
</telerik:GridTemplateColumn>

CSS:
<style type="text/css">
    .right
    {
        float: right;
    }
</style>

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