Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a requirement, please help me.

We have employee entry form, in that we have course dropdown list it contains list of courses. Each employee should select course while saving employee information. We are inserting Selected course id in Employee table.

Now we got a change as all existing courses should be deactiveted and create new courses similarly in Edit employee form we should display deactivated (previously selected) course as temporarily but on dropdown list we should display present active course list to select newly introduced course.

Please help me. I am facing problem to display deactivated course as dropdownlist temporary default item.

Note : deactivated course should not display in dropdown list with active list items.

Regards,
Ramesh
Posted

1 solution

You can disable a specific list item of your dropdownlist as follows-
C#
foreach (ListItem item in drpCourses.Items)
{
  if (int.Parse(item.Value.ToString()) <11) //let's say last old id is 10
  {
     item.Attributes.Add("Style", "color:silver");
     item.Attributes.Add("Disabled", "true");
  }
}


You can customize it as per your requirement.
 
Share this answer
 
v2

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