Asp.net事件生成 [英] Asp.net event generation
本文介绍了Asp.net事件生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个下拉列表,一个用于州,另一个用于城市. nw我想当一个人离开国家下拉列表城市时,应该从数据库b中填充bw我可以为这个asp.net控件生成请假事件.
并且仍然可以从客户端脚本(javascript)调用页面的codbehind方法(c#)吗?
i have two dropdownlist one for state and another for city. nw i want when one leaves the country dropdown city should b populated from database hw could i genererate leave event for this asp.net control.
and also is ther anyway to call a codbehind method(c#) of page from client script(javascript)?
推荐答案
1.您可以使用下拉列表属性来附加事件.
DropdownList呈现为"Select"
.您可以将select的所有属性与下拉列表一起使用.在您的codebehnd文件中,可以说在PageLoad中具有:
1. You can use dropdownlist Attributes in order to attach the event.
DropdownList is rendered as a"Select"
. You can use all the attributes of a select with dropdown. In your codebehnd file, lets say in PageLoad have:
ddlListCountry.Attributes.Add("onChange", "javascript:DropDownListClientSideOnChange();");
2.关于从客户端脚本调用代码隐藏方法,可以使用 XMLHttpRequest .阅读有关它们的信息.
2. About calling code-behind method from client script, you can use XMLHttpRequest. Read about them.
这篇关于Asp.net事件生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文