用户控制 - 调用VB的LinkBut​​ton的(用户控件内)从JavaScript点击事件 [英] User control - calling a vb linkbutton's(within a user control) click event from javascript

查看:183
本文介绍了用户控制 - 调用VB的LinkBut​​ton的(用户控件内)从JavaScript点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能叫一个VB功能 - deleteevent()从一个JavaScript函数usercontrol.ascx.vb在函数clickhandler(E)在usercontrol.ascx。 调用应引起回发,因为我需要的用户控件来显示更改。

目前我正在试图通过一个LinkBut​​ton风格显示器做到这一点:没有,从调用JavaScript函数其Click事件。但我不知道如何调用click事件。

我传递一个值从JavaScript的VB的功能,但我使用的是hiddenfield照顾它。

环境asp.net 3.0语言:VB

感谢。


解决方案

查看调用codebehind方法与jQuery这两个链接:

使用jQuery直接调用ASP.NET AJAX页面方法

<一个href=\"http://weblogs.asp.net/craigshoemaker/archive/2008/09/29/using-jquery-to-call-asp-net-ajax-page-methods.aspx\"相对=nofollow>使用jQuery呼叫

您应该调用的方法ASCX代替ASPX。怎么一回事,因为在运行时所有的用户控件(ASCX)合并到你的页面(ASPX)。

如果你有一个页面的多个实例的用户控件,你应该使用一个参数中的每个用户控件定义方法的上下文。也许用户控件的ClientID。

how can i call a VB function - deleteevent() in usercontrol.ascx.vb from a javascript function in clickhandler(e) in usercontrol.ascx. The call should cause a postback because I need the usercontrol to display the changes.

I am currently trying to do it by using a linkbutton with style display:none, and calling its click event from the javascript function. But i dunno how to call the click event.

I had to pass a value to the vb function from the javascript, but i am taking care of it using a hiddenfield.

the environment is asp.net 3.0 language:vb

Thanks.

解决方案

Check this two links about calling codebehind methods with JQuery :

Using jQuery to directly call ASP.NET AJAX page methods

Using jQuery to Call ASP.NET AJAX Page Methods

You should call aspx instead of ascx methods. beacuse at runtime all user controls (ascx) merged to your page (aspx).

If you have a user control with multiple instances in a page, you should use a parameter to define context of method in each usercontrol. Maybe user control's clientID.

这篇关于用户控制 - 调用VB的LinkBut​​ton的(用户控件内)从JavaScript点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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