How do I right-align a WebForm textbox


How do I make it so a webform textbox (or some other control) is always aligned with the right side of the browser (if the user resizes)?
riceman0Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SwapnilSoftware ArchitectCommented:
Hi riceman0,
Put the control in the table and set the align property of table cell to "right".
like
<table>
    <tr>
        <td align="right">
            <asp:textbox id = "txttest"....>
        </td>
    </tr>
</table>

Cheers!
NetSwap
riceman0Author Commented:

I don't think I can put a webform textbox in an HTML table, can I?
riceman0Author Commented:
I'm referring to the webform textbox in the control toolbox.  Doesn't seem I can drag and drop it into my HTML table in design view.  And I really don't know how to write the code to create one in HTML.
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

SwapnilSoftware ArchitectCommented:
Hi techbie,
Following is my webforms .aspx code. In which I didn't write any code manually all are generated by visual studio itself (Except "content" word for display.)
1
<%@ Register TagPrefix="cc1" Namespace="CustText" Assembly="CustText" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication6.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>WebForm1</title>
        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" Content="C#">
        <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <TABLE id="Table1" cellPadding="1" width="100%" border="1">
                <TR>
                    <TD>Content</TD>
                    <TD>Content</TD>
                    <TD align="right">
                        <asp:TextBox id="TextBox1" runat="server"></asp:TextBox></TD>
                </TR>
               
            </TABLE>
        </form>
    </body>
</HTML>

Regards,
NetSwap

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
riceman0Author Commented:

Is a table the only way to align things?
SwapnilSoftware ArchitectCommented:
Yes because your form may be minimize, maximize or resize basis on that it is difficult to maintain position of the control in any other way.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.