如何映射服务器单击事件DIV HTML元素? [英] How Mapping Server Click Event The DIV HTML Element?
问题描述
对不起,我不会说英语..:)
我有一个问题..
我将UpdatePanel用于异步回发流程
我想为DIV HTML元素映射服务器Click事件,
我搜索了如何映射服务器单击事件DIV HTML元素.
我找到任何解决方案.但解决方案可能是Async PostBack.
解决方案做了页面刷新.
如何映射服务器单击事件Div HTML元素用于异步回发?
如果可以,请编写代码示例,谢谢:D
英语有点难,我会努力学习的! )
public partial class _Default : System.Web.UI.Page, IPostBackEventHandler { protected void Page_Load(object sender, EventArgs e) { div1.Attributes["onclick"] = ClientScript.GetPostBackEventReference(this, "ClickDiv"); } protected void Div1_Click() { // Do something } #region IPostBackEventHandler Members public void RaisePostBackEvent(string eventArgument) { if (!string.IsNullOrEmpty(eventArgument)) { if (eventArgument == "ClickDiv") { Div1_Click(); } } } #endregion }
如果它是Div点击的服务器端事件处理程序,希望对您有所帮助.
I''m sorry but I little English.. :)
I have one question..
I use UpdatePanel For Async PostBack Process
I want mapping Server Click Event For DIV HTML Element,
I searched How can I mapping Server Click event DIV HTML Element.
I find any solution. but the solution coudn''t Async PostBack.
the solution did Page Refresh.
How Can I Mapping Server Click Event The Div HTML Element For Async PostBack?
If you fine, Code Sample Write Please, Thank You :D
English is little difficult, I will learn hard!!
You can handle the click event on a DIV as the code following (div1 is the id of the DIV element)
public partial class _Default : System.Web.UI.Page, IPostBackEventHandler { protected void Page_Load(object sender, EventArgs e) { div1.Attributes["onclick"] = ClientScript.GetPostBackEventReference(this, "ClickDiv"); } protected void Div1_Click() { // Do something } #region IPostBackEventHandler Members public void RaisePostBackEvent(string eventArgument) { if (!string.IsNullOrEmpty(eventArgument)) { if (eventArgument == "ClickDiv") { Div1_Click(); } } } #endregion }
Hope this might help you, if it is server side event handler for Div click.
这篇关于如何映射服务器单击事件DIV HTML元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!