如何在asp.net的linkbutton鼠标悬停时调用c#wewbmethod? [英] how to call a c# wewbmethod on mouseover of linkbutton in asp.net?

查看:76
本文介绍了如何在asp.net的linkbutton鼠标悬停时调用c#wewbmethod?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

is it possible to call a c# webmethod on mouseover on Linkbutton ? what i want is to call a webmethod in which i am binding a repeater control with datatable. How? in aspx:

<asp:LinkButton Text='<%#Eval("SNA")%>' ID="lnkpro1" runat="server"

CssClass="linkbutton" servicemethod="GetRecords"

OnClick="btn_Click1" CommandArgument='<%# Eval("Sets") %>'></asp:LinkButton>
in aspx.cs:

[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod]
public void GetRecords(object sender, EventArgs e)
{

}
I am not getting the point that is how is it possible to call a webmethod on linkbutton mouseover. I have used a webmethod in textbox autocomplete extender but it has a propperty of calling a webmethod but is it so in this case also? Thank you.

推荐答案

创建一个javascript函数,在onmouseover of link按钮时执行,为onmouseover客户端事件分配该方法并使用ajax post在javascript函数中调用web方法。



使用此线程从asp.net中的js文件调用webmethod [ ^ ]
Create a javascript function to execute when onmouseover of link button,assign that method for onmouseover client event and use ajax post to call the web method in the javascript function.

Use this thread calling webmethod from js file in asp.net[^]


在btn_Click1方法中,尝试调用外部的web方法。
In btn_Click1 method, try invoking the web method externally.


这篇关于如何在asp.net的linkbutton鼠标悬停时调用c#wewbmethod?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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