我有一个下拉列表框,其中一个值为其他值。我想把这些值移到最后。请在这件事上给予我帮助。我正在使用的代码如下
ddlAssetsCountryOthersone.DataSource = lstIMAssetsByCountryOthers;
ddlAssetsCountryOthersone.DataTextField = "AssetDescription";
ddlAssetsCountryOthersone.DataValueField = "AssetDescription";
ddlAssetsCountryOthersone.DataBind();
ddlAssetsCountryOthersone.Items.Remove(
ddlAssetsCountryOthersone.Items.FindByValue(
Constants.PhilosophyAndEmphasis.Other.ToString()));
我怎样才能将其他人添加回最后的下拉列表中
在数据绑定后尝试此操作:
ddlAssetsCountryOthersone.Items.Add(new ListItem("Others", "Others"));
顺便说一下,如果你使用Insert方法,你可以将你想要的项目插入到你想要的位置。例如,下面的代码将“其他”选项添加到第四个订单:
ddlAssetsCountryOthersone.Items.Insert(4, new ListItem("Others", "Others"));
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)