【问题标题】:What are the asp:DropDownList client side events?什么是 asp:DropDownList 客户端事件?
【发布时间】:2009-08-10 06:26:17
【问题描述】:

我想知道 asp:DropDownList 的客户端事件(如 onChange)。

【问题讨论】:

  • 您的具体需求是什么?

标签: asp.net events drop-down-menu client-side


【解决方案1】:

您是在谈论 ASP 应用程序吗?此应用程序生成 HTML 代码,因此您拥有所有可用的 HTML 事件,select 标记(select 是下拉列表的 HTML 标记)如下:

  • onchange
  • onclick
  • ondblclick
  • onmousedown
  • onmouseup
  • onmouseover
  • onmousemove
  • onmouseout
  • onkeypress
  • onkeydown
  • onkeyup
  • onfocus
  • onblur

【讨论】:

  • 是的,对不起。更新了我的答案。
  • onfocusonblur 也不见了
  • 在我的回答中也添加了这些内容。
  • 这里值得注意的是,您必须使用括号调用您的事件,这与服务器标签中的常规事件调用不同;服务器端事件:OnSelectedIndexChanged="Event" 客户端事件:onchange="Event()"
【解决方案2】:

您可以通过编程将onchange 客户端事件分配给 DropDownList 控件:

DropDownListID.Attributes["onchange"] = "javaScriptFunction();";

看看这篇文章:

【讨论】:

  • 谢谢。尽管接下来的问题是,如何获得 SELECT 元素的客户端 ID?是 DropDownListID.ClientID 还是有一个包含 DIV 的 DIV 被添加到它周围?
猜你喜欢
  • 2018-07-01
  • 1970-01-01
  • 2019-01-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多