用于绑定临时文本的下拉列表 [英] Dropdown list to bind temporary text

查看:59
本文介绍了用于绑定临时文本的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有要求,请帮助我。



我们有员工报名表,因为我们有课程下拉列表,其中包含课程列表。每位员工在保存员工信息的同时应选择课程。我们在Employee表中插入了选定的课程ID。



现在我们得到了一个更改,因为所有现有课程都应该被取消激活并在编辑员工表单中创建新课程我们应该显示暂停(之前选择)课程暂时但在下拉列表中我们应该显示当前活动课程列表以选择新引入的课程。



请帮助我。我面临的问题是显示停用的课程作为下拉列表临时默认项目。



注意:停用的课程不应显示在包含活动列表项的下拉列表中。



问候,

Ramesh

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

推荐答案

您可以禁用下拉列表中的特定列表项follow-

You can disable a specific list item of your dropdownlist as follows-
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.


这篇关于用于绑定临时文本的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆