Padding AutoCompletionList to the right of TextBox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bheeshma
    New Member
    • Mar 2011
    • 1

    Padding AutoCompletionList to the right of TextBox

    By default, the AutoCompletion List will display to the left of its Target textbox.Left positions of both Textbox and AutoCompletionL ist is same.

    Is there a way or CSS Settings to align the same to the right, so that both AutoCompletionL ist and TextBox end with same right positions.

    I have AutoCompleteExt ender mapped for a TextBox. When the AutoCompleteLis t gets displayed, it is postioned to left same as TextBox left position, which is it's default behaviour.

    As my AutoCompleteLis t has wide data, i want the list to right aligned with the textbox.

    No style for textbox.
    Below is the .aspx
    Code:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style>
            .completionListElement
            {
                background-color: ivory;
                color: black;
                border: solid 1px gray;
                cursor: pointer;
                font-family: Arial;
                font-size: 10pt;
                width: auto !important;
            }
            .listItem
            {
            }
            .highlightedListItem
            {
                background-color: Gray;
                color: Red;
            }
            .txt
            {
                background-repeat: no-repeat;
                background-position: right;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <cc1:ToolkitScriptManager runat="server" ID="tcm">
        <Services>
                <asp:ServiceReference Path="~/WebService1.asmx"  />
            </Services>
        </cc1:ToolkitScriptManager>
    
        <table width="100%" border="1">
            <tr>
                <td width="50%">
                    <asp:Button ID="Button1" runat="server" Text="Button" />
                </td>
                <td width="50%" align="right">
                    <asp:TextBox runat="server" ID="txtComments"> </asp:TextBox>
                    
                    <cc1:AutoCompleteExtender ID="ace1" runat="server" TargetControlID="txtComments"
                        CompletionListCssClass="completionListElement" CompletionListItemCssClass="listItem"
                        CompletionListHighlightedItemCssClass="highlightedListItem" ServicePath="~/WebService1.asmx"
                        ServiceMethod="HelloWorld" MinimumPrefixLength="3" 
                        EnableCaching="true"  CompletionListElementID="divlist"></cc1:AutoCompleteExtender>
                    <div id="divlist" runat="server">
                    </div>
                </td>
            </tr>
        </table>
        </form>
    </body>
    </html>
    Last edited by Niheel; Mar 2 '11, 10:33 PM. Reason: Posts merged into one singular question. When asking a question. Provide all the details necessary so that the person helping you doesn't have to spend time asking you for it.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    I'm not sure what you're trying to do...

    Did you try setting the TextBox's style to text-align:right?

    -Frinny

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      I understand you now :)
      What css styles are being applied to the textbox?

      -Frinny

      Comment

      Working...