Vinay
unread,Nov 6, 2009, 6:09:09 AM11/6/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
hi there,
I m trying to call server side function from javascript in
asp.net.
Right now i m trying a simple example..but i m unable to do it. hope u
can help in that.
Body Code:
=======================
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePageMethods="true">
</asp:ScriptManager>
<script language="javascript" type="text/javascript">
function CallSum()
{
PageMethods.say("Hello World!!!");
}
</script>
<div>
<asp:Button ID="btn" runat="server" OnClientClick="CallSum()"
Text="Show" />
</div>
</form>
</body>
</html>
=====================
Serverside Code
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default3 :
System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Services.WebMethod]
public void go(string message)
{
Response.Write("<script>alert('"+message+"');</script>");
}
}
=============================================
The above code not showing a message box on button click.
Thanks in advance..
Vinay