简体   繁体   English

asp.net中的html按钮

[英]html button in asp.net

i am using html in asp page where i have to use html button.我在asp页面中使用html,我必须使用html按钮。 but the problem is i want to do the coding on html button in c#.但问题是我想在 c# 中的 html 按钮上进行编码。 but by using html button i cant do that.. is there any other way to do so..i am using html button as:但是通过使用 html 按钮我不能这样做.. 有没有其他方法可以这样做.. 我使用 html 按钮作为:

 <button id="MyButton" runat="server" onserverclick="MyButton_ServerClick" >
   </button>

if i double-click on the html button from.aspx page it generates the code as function under script as:如果我从.aspx 页面双击 html 按钮,它将在脚本下生成代码为 function:

 function MyButton_onclick() {

        }

what can i do for this..我能为此做些什么..

You could use jQuery to call a .net WebService to do stuff on the server deepending on what you want to achieve.您可以使用 jQuery 调用 .net WebService 在服务器上做一些事情,加深您想要实现的目标。

Here an example. 这里举个例子。

Make AJAX request like this:像这样发出 AJAX 请求:

$('#Button').click(function() {
    $.ajax( {
    type:'Get',
    url:'http://mysite.com/mywebservice',
    success:function(data) {
     alert(data);
    }

    })

});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM