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="AutoFitDropDownLis t"
width="90%"
font-size="100%"
backcolor="#ffff99"/>
Then in my edititemtemplate I use something like:
<asp:TextBox ID="txtDrivewayGateSpecify " runat="server"
Text='<%#Bind("DrivewayGat eSpecify") %>'
SkinID="AutoFitTextBox"/>
<asp:DropDownList ID="ddlFenceBreezeTypeName " runat="Server"
DataValueField="FenceTypeI D"
DataTextField="Name"
DataSourceID="odsFenceType Name"
SelectedValue='<%#Bind("Fe nceBreezeT ypeID") %>'
SkinID="AutoFitDropDownLis t"
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?
<asp:textbox runat="server" skinid="AutoFitTextBox"
width="88%"
font-size="100%"
backcolor="#ffff99"
bordercoler="#4169e1"
borderwidth="1px"
borderstyle="solid"/>
<asp:dropdownlist runat="server" skinid="AutoFitDropDownLis
width="90%"
font-size="100%"
backcolor="#ffff99"/>
Then in my edititemtemplate I use something like:
<asp:TextBox ID="txtDrivewayGateSpecify
Text='<%#Bind("DrivewayGat
SkinID="AutoFitTextBox"/>
<asp:DropDownList ID="ddlFenceBreezeTypeName
DataValueField="FenceTypeI
DataTextField="Name"
DataSourceID="odsFenceType
SelectedValue='<%#Bind("Fe
SkinID="AutoFitDropDownLis
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.