添加一个新值下拉列表框中 [英] Adding a new value to the drop down list box

查看:159
本文介绍了添加一个新值下拉列表框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个下拉列表框,其中有一个值是别人。我想将这些值到最后。请帮我这个。在code我现在用的就是如下:

I have a drop down list box which has one of the values to be others. I want to move these value to the last. Please help me with this. The code i am using is as follows

ddlAssetsCountryOthersone.DataSource = lstIMAssetsByCountryOthers;
ddlAssetsCountryOthersone.DataTextField = "AssetDescription";
ddlAssetsCountryOthersone.DataValueField = "AssetDescription";
ddlAssetsCountryOthersone.DataBind();
ddlAssetsCountryOthersone.Items.Remove(
             ddlAssetsCountryOthersone.Items.FindByValue(
                Constants.PhilosophyAndEmphasis.Other.ToString()));

我怎么能增加别人回的下拉列表中的最后一个

How can i add the others back to the drop down list in the last

推荐答案

试试这个您的数据绑定后:

try this after your databind :

ddlAssetsCountryOthersone.Items.Add(new ListItem("Others", "Others"));

通过,如果你使用的方法插入的方式,你可以插入你要你想要的位置的项目。例如,code以下添加其他选项到4阶:

By the way if you use Insert method, you can insert the item you want to the position you want. For example the code below adds the Other option to the 4th order :

ddlAssetsCountryOthersone.Items.Insert(4, new ListItem("Others", "Others"));

这篇关于添加一个新值下拉列表框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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