TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
yadagiri uppari
NA
277
189.9k
how to call code behind method from aspx page
Aug 10 2013 1:14 AM
Hi....actually when browser is closed then event has to be triggered,,,when browser is closing control is going to aspx page but from there i am unable to call code behind method
aspx:
html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Detect Browser Exit</title>
</head>
<body>
<script type="text/javascript" language="Javascript">
function TestAJAX11() {
//alert('This is Testing of Close event');
PageMethods.TestAJAX();
}
window.onbeforeunload = function () { TestAJAX11("hello", "hai"); }
</script>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server" />
Detect Browser Exit
</form>
</body>
</html>
codebehind:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
[ScriptMethod]
[WebMethod]
public static string TestAJAX()
{
string a="hai";
string b = "hello";
string c = a + b;
return c;
}
Reply
Answers (
1
)
Json Webservice
Active tab index changed event does not get fired