Link to home
Start Free TrialLog in
Avatar of rmk
rmk

asked on

Autofit textboxes and dropdown lists

When I put an ASP.NET 2.0 gridview or formview control into edit mode and display a text box or dropdownlist, I want to be able to react to the browser's font size and to my liquid layout. The best I've been able to come up with is by using skinids as follows:
<asp:textbox runat="server" skinid="AutoFitTextBox"
             width="88%"
             font-size="100%"
             backcolor="#ffff99"
             bordercoler="#4169e1"
             borderwidth="1px"
             borderstyle="solid"/>
<asp:dropdownlist runat="server" skinid="AutoFitDropDownList"
                  width="90%"
                  font-size="100%"
                  backcolor="#ffff99"/>

Then in my edititemtemplate I use something like:
<asp:TextBox ID="txtDrivewayGateSpecify" runat="server"
                                     Text='<%#Bind("DrivewayGateSpecify") %>'
                                     SkinID="AutoFitTextBox"/>

<asp:DropDownList ID="ddlFenceBreezeTypeName" runat="Server"
                             DataValueField="FenceTypeID"
                             DataTextField="Name"
                             DataSourceID="odsFenceTypeName"
                             SelectedValue='<%#Bind("FenceBreezeTypeID") %>'
                             SkinID="AutoFitDropDownList"
                             AppendDataBoundItems="true">
                            <asp:ListItem />
                            </asp:DropDownList>
Although this works reasonalby well (it adjusts both the height and width), it's nowhere near what I would like. Does anyone have a better way?
ASKER CERTIFIED SOLUTION
Avatar of lunadl
lunadl
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial