html button in asp.net
i am using html in asp page where i have to use html button. but the problem is i want to do the coding on html button in c#. but by using html button i cant do that.. is there any other way to do so..i am using html button as:
<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:
function MyButton_onclick() {
}
what can i 开发者_JAVA百科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.
Here an example.
Make AJAX request like this :
$('#Button').click(function() {
$.ajax( {
type:'Get',
url:'http://mysite.com/mywebservice',
success:function(data) {
alert(data);
}
})
});
精彩评论