在ASP.NET服务器控件中创建单击事件 [英] Creating click event in ASP.NET server control

查看:70
本文介绍了在ASP.NET服务器控件中创建单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个在网页上绘制图形的服务器控件,


我渲染div元素以绘制垂直条。


我想在点击任何一个栏时发起一个事件,


请提供解决方案或参考



关心Kumar Gaurav。

解决方案

你好urprob,


 你没有提到应该是事件火灾@客户端/服务器端?


无论如何你想要解雇@服务器端我们有很多方法让我给每个人一个提示。 。


  1. 您可以创建一个客户端Side OnClick事件并引发一个javascript方法,您可以在其中手动__doPostback方法,以便它将调用您的服务器端加载方法,您可以将其重定向到特定方法。
  2.   您可以创建一个客户端Side OnClick事件并引发一个javascript方法,您可以在其中对其他aspx / ashx文件进行AJAX调用你可以拥有你的代码(如果您的代码不依赖于屏幕上的其他信息,建议使用此代码)
    并且您可以通过普通或JSON对象中的POST方法将一些数据发送到页面。

如果您需要更多信息,请告诉我,因为我知道这只是对您的一个暗示....


希望它能帮助您...谢谢


I'm creating a server control that draws graphs on webpage,

i render div elements for drawing vertical bars.

i want to fire an event when any of those bars are clicked,

Please provide solution or reference


Regards Kumar Gaurav.

解决方案

Hi urprob,

 you didn't mentioned should be event fire @ Client side / server side?

anyway if you want to fire @ server side we have many ways let me give an hint on each of them..

  1.  you can create a client Side OnClick event and raise a javascript method in which you can manually can __doPostback method so that it will call your server side load method where you can redirect it to specific method.
  2.   you can create a client Side OnClick event and raise a javascript method in which you can have a AJAX call to other aspx/ ashx file where you can have your code (this is recommended if your code is not much depending on other info on the screen) and you can send some data to the page through the POST method in plain or JSON object.

Let me know if u need more information as i know this is just an a hint for you....

Hope it will help you... thanks


这篇关于在ASP.NET服务器控件中创建单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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