Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
i add 'select' at top position (i.e. as first item) of my dropdown list.
 
it's like-
 
--SELECT--
Item1
item2
item3
item4
 

 
so i want that this 'select' become disable, how can i do this...pls give me sggetions frnds?
Posted 28-Jan-13 19:29pm
GDdixit523
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The exact answer that you need is in the below link
how to avoid 'please select' in dropdown list to consider as data?[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

While you are reading items from dropdown, you add below condition, this way option
--Select-- never gets executed.
if (ddl.SelectedIndex != 0) // ddl being your dropdown
{
   // add your code here.   
}
 
OR
 
You can disable the button if selected index of your dropdown is zero (0).
This is assuming that you have a button click event which uses dropdown value.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Use jquery for Disabling the dropdown list items like below
$(document).ready(function() {   
   $('#ddlListId option:contains("HTML")').attr("disabled","disabled");
});​
Hope this helps
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

hi please check my ans
 
<asp:DropDownList runat="server" ID="ddlBank">
  <asp:ListItem Text="Select" Value="" disabled="disabled" />
  <asp:ListItem Text="bank 1 " Value="bank 1"  />
  <asp:ListItem Text="bank 2 " Value="bank 2"  />
  <asp:ListItem Text="bank 3 " Value="bank 3"  />
  <asp:ListItem Text="Restaurant" Value="Restaurant" disabled="disabled" />
  <asp:ListItem Text="Test" Value="value"  />
  <asp:ListItem Text="restaurant 1" Value="restaurant 1"  />
  <asp:ListItem Text="restaurant 2" Value="restaurant 2" />
  <asp:ListItem Text="restaurant 3" Value="restaurant 3"  />
  Permalink  

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



Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 14 Aug 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid