asp. formatting <div> tag challange

Joined
May 20, 2008
Messages
1
Reaction score
0
i am trying to solve a problem to do with a drop down box in asp.net. currently when you click on the drop down it doesnt extend so not all of the text is visable. i have managed to get round this problem using css and a div tag although as you would expect this causes the dropdown box to become a paragraph of its own rather than on the one line with the few other dorp downs it works with.

if anyone knows of how to format the dropdown without using the div tag it be a great help. thanks.

css code:

<style type="text/css">
#wp {width:100px;overflow:hidden;border-right:1px solid gray;float:right}
</style>

drop down list my code should work on:

<div id="wp">
<asp:DropDownList ID="_LSTCOMPONENTTYPE" runat="server" BackColor="#FFFFC0" AutoPostBack="True"
DataSourceID="SqlDataSource1" DataTextField="LastName" DataValueField="LastName">
</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:mybdConnectionString %>"
SelectCommand="SELECT [LastName] FROM [Person]"></asp:SqlDataSource>
</div>

full code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>

<style type="text/css">
#wp {width:100px;overflow:hidden;border-right:1px solid gray;float:right}
</style>


</head>
<body>
<form id="form1" runat="server" >
<div class="os" style="width:100px;overflow:hidden;border-right:1px solid gray;">
<asp:DropDownList ID="DropDownList1" runat="server" >
<asp:ListItem>Test</asp:ListItem>
<asp:ListItem>aldfdlslsdkwele dslksd0id sldsids dldiels ddksow dlsiskd dsosoekd oeke</asp:ListItem>
<asp:ListItem>Another Test.</asp:ListItem>
</asp:DropDownList><br />
</div>
<br />
<br />

<asp:ImageButton ID="_BTNSUBMIT" runat="server" ImageUrl="edit_on.jpg" />

<asp:DropDownList id="_LSTTECHNOLOGYTYPE" runat="server" AutoPostBack="True" BackColor="#FFFFC0"
Height="24px" Width="56px">
</asp:DropDownList>

<div id="wp">
<asp:DropDownList ID="_LSTCOMPONENTTYPE" runat="server" BackColor="#FFFFC0" AutoPostBack="True"
DataSourceID="SqlDataSource1" DataTextField="LastName" DataValueField="LastName">
</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:mybdConnectionString %>"
SelectCommand="SELECT [LastName] FROM [Person]"></asp:SqlDataSource>
</div>

<asp:DropDownList ID="_LSTWORKTYPE" runat="server" AutoPostBack="True" BackColor="#FFFFC0">
</asp:DropDownList>
<
<asp:TextBox ID="_TXTCOMPONENTDESC" runat="server" AutoPostBack="True" BackColor="#FFFFC0"
Width="248px"></asp:TextBox>

<asp:DropDownList ID="_LSTCOMPONENTBUILDCOMPLEXITY" runat="server" AutoPostBack="True"
BackColor="#FFFFC0">
</asp:DropDownList>

<nobr>
<asp:TextBox ID="_TXTCOMPONENTBUILDHOURS" runat="server" BackColor="#FFFFC0" ReadOnly="True"
Width="48px"></asp:TextBox><asp:ImageButton ID="_BTNDELETE" runat="server" AlternateText="Delete this component"
ImageUrl="icon_delete.gif" /></nobr><asp:Label ID="_LBLCOMPONENTID" runat="server"
Visible="False"></asp:Label><asp:Label ID="_LBLESTIMATEID" runat="server" Visible="False"></asp:Label><asp:Label
ID="_LBLSECTIONID" runat="server" Visible="False"></asp:Label>
<asp:Label ID="_JAVASCRIPT" runat="server"></asp:Label>

<script type="text/javascript">
function ExpandDDL(ddl) {
ddl.style.width = 'auto';
}
function CollapseDDL(ddl) {
ddl.style.width = '200px';
}
</script>
</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top