下拉列表中选择的项目 [英] dropdownlist selected item

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

问题描述

如何在aspx.cs页面中触发下拉列表中的selecteditem

how to fire dropdownlist selecteditem in aspx.cs page

推荐答案

这是 Asp.net 的基础.最好您可以读一本书来了解下拉列表的流程和事件.您应该阅读DropDownList的文档.
试试这个:
HTML:
This is the basic of Asp.net. Better you could have gone through a book to understand the flow and events of dropdown list. You should read the documentation of DropDownList.
Try this:
HTML:
<asp:dropdownlist id="DropDownList1" runat="server" xmlns:asp="#unknown">
     onselectedindexchanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true">
</asp:dropdownlist>


C#:


C#:

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
    Response.Write(DropDownList1.SelectedItem.Text);
}




祝一切顺利.
--Amit




All the best.
--Amit


亲爱的朋友,试试这个"

Dear Friend Try This one"

Click on me to get Your Answer


右键单击下拉列表列表,

选择属性,

单击属性框中的事件.

选择SelectedIndexChanged事件和

双击它.在后端用C#或VB编写代码.
Right Click on Dropdown List,

Choose Properties ,

Click Events in Property Box.

Choose SelectedIndexChanged Event and

Double Click on it. Write Code in C# or VB at backend.


这篇关于下拉列表中选择的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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