如何在asp.net中编辑下拉列表值 [英] how to edit the dropdownlist value in asp.net

查看:67
本文介绍了如何在asp.net中编辑下拉列表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行模式下有dropdownlist1如下



coursename dropdownlist1(AFF)





我想编辑那个AFF课程,我怎样才能编辑dropdownlist1中的AFF值。



为什么我可以编辑dropdownlist1值。



请帮帮我。如何在asp.net中使用c#。

I have dropdownlist1 in run mode as follows

coursename dropdownlist1 (AFF)


I want to edit that AFF course for that how can i edit the AFF value in dropdownlist1.

for that how can i edit the dropdownlist1 value.

please help me. how can i do in asp.net using c#.

推荐答案

<asp:DropDownList ID="dropdownlist1" runat="server">
    <asp:ListItem Text="coursename dropdownlist1 (AFF)" Value="AFF" />
    <asp:ListItem Text="coursename dropdownlist1 (ABC)" Value="ABC" />
</asp:DropDownList>







protected void Page_Load(object sender, EventArgs e)
{

    ListItem target = dropdownlist1.Items.FindByValue("AFF");
    if (target != null)
    {
        target.Value = "new value";
        target.Text = "New text";
    }
}


这篇关于如何在asp.net中编辑下拉列表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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