Click here to Skip to main content
12,999,833 members (50,872 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
GDdixit542
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 3 Dec 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100