Click here to Skip to main content
15,991,360 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 2 drop down lists. When i select 1st value from the 1st ddl, the 2nd ddl gets disabled. When i select 2nd value from 1st ddl, the 2nd ddl enables. This just what I needed. But there is a problem. When the 2nd ddl gets disabled, its size increases automatically & I don't want that. T have used table, update panel, trigger, content panel, still its not working.
I am attaching the portion of the code. Kindly help.

ASP.NET
<td>
<label>Activity&nbsp;</label>
</td>
<td>
<asp:UpdatePanel ID="Update_Panel1" runat="server">
<contenttemplate>
<asp:DropDownList ID="ddl_Activity1" runat="server" AutoPostBack="True" 
class="w100" onselectedindexchanged="ddl_Activity1_SelectedIndexChanged">     
<asp:ListItem Text="Create Permanent Water Holes" Value="1">
<asp:ListItem Text="Improve Water Storage" Value="2">

</contenttemplate>
<triggers>
<asp:AsyncPostBackTrigger ControlID="ddl_SubActivity1" EventName="SelectedIndexChanged"/>
</triggers>

</td>
<td>
<asp:label ID="lbl_SubActivity1" runat="server">Sub&nbsp;Activity
</td>
<td>
<asp:UpdatePanel ID="Update_Panel2" runat="server">
<contenttemplate>
<asp:DropDownList ID="ddl_SubActivity1" runat="server" 
class="w100" AutoPostBack="True">
<asp:ListItem Text="Desilting" Value="1">
<asp:ListItem Text="Deepening" Value="2">
<asp:ListItem Text="Repairing" Value="3">

</contenttemplate>
<triggers>
<asp:AsyncPostBackTrigger ControlID="ddl_SubActivity1" EventName="SelectedIndexChanged"/>
</triggers>
    
</td>
Posted
Updated 24-Jan-14 18:15pm
v2

1 solution

Define a desired size (width) to the DropDownList and check it

XML
<asp:DropDownList ID="ddl_SubActivity1" runat="server" Width="100px"
            class="w100" AutoPostBack="True">
 
Share this answer
 
Comments
Rahul VB 25-Jan-14 14:22pm    
simple +5
Karthik_Mahalingam 25-Jan-14 14:23pm    
Thanks Rahul
Rahul VB 25-Jan-14 14:29pm    
hey Karthik take a look at this :
http://www.codeproject.com/Questions/715656/Unable-to-find-any-meaningful-answer-from-google
Karthik_Mahalingam 25-Jan-14 14:42pm    
check it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900