Calling C# From JS

Reply

Join Date: Mar 2008
Posts: 327
Reputation: sonia sardana has a little shameless behaviour in the past 
Solved Threads: 7
sonia sardana sonia sardana is offline Offline
Posting Whiz

Calling C# From JS

 
0
  #1
Feb 19th, 2009
I have serached on the internet,I found the links but none of them provide me the solutions.
One of the sites from that I refer-
http://sappidireddy.wordpress.com/20...n-aspnet-ajax/

Code-Behind Page

  1. public partial class _Default : System.Web.UI.Page
  2. {
  3.  
  4. [System.Web.Services.WebMethod]
  5. public static int AddTwoNumbers(Int32 a)
  6. {
  7. int addtion = a + a;
  8. return addtion;
  9. }
  10. }


Source Tab
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7. <title>Untitled Page</title>
  8. <script type ="text/javascript" language ="javascript" src ="JScript.js">
  9. </script>
  10. </head>
  11. <body>
  12. <form id="form1" runat="server">
  13. <div>
  14. <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"/>
  15. </div>
  16. <table>
  17. <tr>
  18. <td style="width: 100px">
  19. <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
  20. <td style="width: 100px">
  21. </td>
  22. <td style="width: 100px">
  23. </td>
  24. </tr>
  25. <tr>
  26. <td style="width: 100px">
  27. </td>
  28. <td style="width: 100px">
  29. </td>
  30. <td style="width: 100px">
  31. </td>
  32. </tr>
  33. <tr>
  34. <td style="width: 100px">
  35. </td>
  36. <td style="width: 100px">
  37. </td>
  38. <td style="width: 100px">
  39. </td>
  40. </tr>
  41. </table>
  42. </form>
  43. </body>
  44. </html>


JS File
  1. function sum(int a)
  2. {
  3. // call server side method
  4. pagemethods.AddTwoNumbers(a);
  5. }

Errors[color=#CC0000]1) Unknown server tag 'aspcriptManager'.
2)Element 'ScriptManager' is not a known element. This can occur if there is a compilation error in the Web site.

Plz help me out.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,076
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 142
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Banned

Re: Calling C# From JS

 
3
  #2
Feb 20th, 2009
Start by learning how ASP works.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 484
Reputation: DangerDev has a spectacular aura about DangerDev has a spectacular aura about 
Solved Threads: 59
DangerDev's Avatar
DangerDev DangerDev is offline Offline
Posting Pro in Training

Re: Calling C# From JS

 
0
  #3
Feb 20th, 2009
Originally Posted by Rashakil Fol View Post
Start by learning how ASP works.
Freedom in the Mind, Faith in the words.. Pride in our Souls...
Indian Developer
http://falaque.wordpress.com/
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 818 | Replies: 2
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC