If I'm reading your stuff correctly, your HorizontalAlign=right is
applied to the entire contents of the item, not the TextBox itself.  I
believe the only way to right-align the contents of a textbox is to
apply the "text-align: right" css attribute to the textbox.

I believe this will work if you just add:
style="text-align: right;" to the attributes of the TextBox markup -
even though this is not technically valid, I believe it will still
work.  To do it "correctly", I believe you'd need to apply the
attribute to the textbox in server code, such as:
myTextBox.Style["text-align"] = "right";

Since you're using this in the edit of a grid row, I believe this
would be done on one of the event handlers - maybe OnRowEditing or
something like that (I haven't worked with editable grids in a while,
so I forget exactly where this goes, or the exact syntax for
retrieving that TextBox control).

On Feb 10, 10:19 am, Learner <[email protected]> wrote:
> Hi,
>
>    The below column display Amount so I am trying to alighn it to the
> right. But it doesn't seem like it aligns to the the right when I
> click on the Edit button on the row on my DataGrid. Can some please
> help me to see what am I missing here?
>
> Thanks,
>
> -L
>
> <asp:TemplateColumn HeaderText="Contri<br>bution With Held">
>                                                                               
>   <HeaderStyle Font-Bold="True" HorizontalAlign="Center"></
> HeaderStyle>
>                                                                               
>   <FooterStyle Font-Bold="True" />
>                                                                               
>   <ItemStyle Width="40px" CssClass="SFGridItem" VerticalAlign
> ="Bottom" HorizontalAlign ="right"></ItemStyle>
>                                                                               
>   <ItemTemplate>
>                                                                               
>           <asp:Label id="lblContributionWithHeld"
> runat="server" CssClass="SFGridItem" Width="40px" Text= '<%#
> DataBinder.Eval(Container.DataItem, "ContributionWithHeld","{0:c}")
> %>' />
>                                                                               
>   </ItemTemplate>
>                                                                               
>   <EditItemTemplate>
>                                                                               
>           <asp:TextBox id="txtContributionWithHeld" runat="server"
> CssClass="SFGridItem" width="40px" Text= '<%# Server.htmlencode
> (DataBinder.Eval(Container.DataItem, "ContributionWithHeld")) %>' />
>                                                                               
>           </EditItemTemplate>
>                                                                         
> </asp:TemplateColumn>

Reply via email to