Call Server Side methods from Client Side

Hi,

How to call Server Side methods from ClientSide with results back. Earlier we were using Anthem approach but now want to use some thing with AJAX.

Thanks in Advance.

 


Regards
Sreenivas.
0
jakkulas
1/23/2008 4:47:45 PM
asp.net.ajax-discussion 13973 articles. 1 followers. Follow

4 Replies
1515 Views

Similar Articles

[PageSpeed] 57
Get it on Google Play
Get it on Apple App Store

you can use the page methods of the ClientScript  control ,

please read  : http://aspalliance.com/1294_CodeSnip_Handle_Browser_Close_Event_on_the_ServerSide

 


Regards,

Anas Ghanem.


Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF USE"). -- Thanks!

0
anas
1/23/2008 5:08:04 PM

Still this has problem on refresh. Is there any other way to do it please?. Need this asap.


Regards
Sreenivas.
0
jakkulas
1/23/2008 9:32:12 PM

Just trying to put the question in details. I have button and onclick of the button I want the server side method to be executed  which returns the server time to client. Also should handle callbacks.

This approach was working fine with Anthem but doesn't work with WebUserControl. Thats why want implement AJAX feature.


Regards
Sreenivas.
0
jakkulas
1/23/2008 9:38:50 PM

Hi,

Thank you for your post!

Why not refer to official document?

Here is it:

http://www.asp.net/ajax/documentation/live/tutorials/ExposingWebServicesToAJAXTutorial.aspx, expecially the following section in that page:

Calling Static Methods in an ASP.NET Web Page

You can add static page methods to an ASP.NET page and qualify them as Web methods. You can then call these methods from script as if they were part of a Web service, but without creating a separate .asmx file. To create Web methods in a page, import the System.Web.Services namespace and add a WebMethodAttribute attribute to each static method that you want to expose.

To be able to call static page methods as Web methods, you must set the EnablePageMethods attribute of the ScriptManager control to true.

The following example shows how to call static page methods from the client script to write and read session-state values.

 
For more information about this topic, see
  1. Exposing Web Services to Client Script

  2. Calling Web Services from Client Script

 Best Regards,


Sincerely,
Jin-Yu Yin
Microsoft Online Community Support
0
Jin
1/29/2008 11:11:27 AM
Reply:

Similar Artilces:

Call server side method from client side...
I'm using Jquery to call a modal popup dialog and depend on what user select i nead to call a method to populate my generic list can that be don or is no posible way to do that...     Sorry for my bad english...Florim Maxhuni  If you need to call the server from the clientside, you need to look into Ajax Eric Pascarello.com | Twitter epascarello | LinkedIn...

Calling server-side methods from client-side event
Hello,i'm novice in asp.net client-side script and i have a simple question: is it possibile to call a server-side method (ex. c# managed code) from a java script client-side function linked to an event?Thanks all  Luca GuccioneGenova, Italy Yes you can. It's very easy using web methods from code behind, jquery and the script manager. See this very good blog post explaining the steps: http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/ mySoZa lucaguccione: Hello, i'm novice in asp.net client-side script and i have a simple quest...

Calling server-side code from client-side
Hi,  I´m implementing some shortcut functionality in my web forms and wanna know where i can find something that explains, for example, how to call the handler event "onclick" of a button. I´m using this library to add shortcuts to my controls: http://www.openjs.com/scripts/events/keyboard_shortcuts/   And I want to "link" some key combination for the event handlers of the controls. Does anybody knows?  Thanks. You could attach an AJAX event to the Javascript shortcut event handler so, for example, the shortcut function will trigger a button cl...

Calling a client side function from the server side
Is it possible to call a client side function from the server side. I dont want to invoke that function through button click. I just want to call that to do some operations.  Regards, Aish Use the below code ASP.NET 2.0 Page.ClientScript.RegisterStartUpScript(this.GetType(),"callfunction","<script language=javascript>Test();</script>"); ASP.NET 1.X Page.RegisterStartUpScript("callfunction","<script language=javascript>Test();</script>"); Where Test() is the javascript function. HCHaissam Abdul MalakMCAD.NET| Blog | No, it is not possible.  The cl...

Calling server side scripts from client side
Hello, Can Anyone help out from the following : It is regarding calling server side scripts from client side events. I am able to instantiate a jaguar component in the server side script written in the body of the HTML page as follows : <% var mycomp = java.CreateComponent ("pkg_dispatch/n_jaguar", "iiop://jaguar:9000", "Jagadmin", "" ); if (mycomp == null) { document.writeln("ERROR: failed to instantiate !"); return; } %> I want to use the instance of the jaguar component else wher...

How to call server side function on client side
Hi,   How to call server side function on client side? here i want to call change() function on textbox onchange event.   <script language="javascript">    function serverfunction()    {    }    </script><input id="Text1" onchange="javascript:serverfunction();"  type="text" /> code behind:  public void change()    {        Response.Write("hello");    } <script type=&quo...

differences between server side asynchronous Web methods and client side asynchronous Web methods
Hi,   can anyone expalin what are the differences between server side asynchronous Web methods  and client side asynchronous Web methods in ASP.Net 2.0 ?   any best articles on serverside asynchronous Web methods  ?   Thanks,  hi, check this url, Server-Side Asynchronous Methods for ASP.NET, http://www.codeproject.com/KB/cpp/asyncws.aspx   Calling the Server-Side method asynchronously from Client Script, http://www.c-sharpcorner.com/UploadFile/dipenlama22/Callbacks07182006093320AM/Callbacks.aspx...

Firing both Client side event and server side event for server side button
I am having some difficulties getting this to work.. I have button_click (Asp.net) and ClientClick (Javascript).  Javascript is firing fine.  Server script is not. may be you have return return false in the in the javascript which is why its not firing server side event.You should add javascript evelt like thisbutton1.onclientclick = "functionname" Function should nopt return false. Vikram www.vikramlakhotia.comPlease mark the answer if it helped you...

Is it possible to call client side function from server side code without initial client request?
Atlas is great. I'm using timer to periodically check database changes on server to populate client side controls with new data. Is it possible to do it without a lot of client requests to server which takes a huge useless network traffic? Server should call client side function on all connected clients when, for example, 'database updated' event occurs on server. Thanks. Hi~ Just for your interest, I think you could have a look at Comet, many web IM like Gmail's embeded Gtalk and meebo.com are built on this architecture你好! Just FYI o_O...

Client side script calling Server side functions
Hi, I'm currently developing an ajax.net enabled aspx page that contains a usercontrol (which is based on the listbox but extends it to include icons to represent invalid data). http://www.djcharlie.co.uk/WeeeCareResolutionCentre.jpg I want the onClick event of the selected TR to call an asp.net server function which then populates the controls to the right hand side in the page. Obviously because the row is just rendered HTML overriden from the base class I can only assign a javascript function to the onClick event. So I need a way of calling a server side function that will populate th...

Call client side and server side events together.
I have one textbox on my aspx page.I want to validate amount in that textbox. If it exceeds 100 then the alert message should show that amount is bigger.And it should not go further. But if the amount is less than or equal to 100, then after checking the condition onclientside, it should to the server side TextChanged event.I have written a javascript function which is being called on "onchange" event of textbox and if the value is valid, then it should call serverside textchanged event of the same textbox.Please its urgent. Mark it as Answer if you find it Helpful.Shailen  ...

calling server side function from client side script
i have a web form that includes a function named "koko()" in its server side class i want to write a script code in in its HTML script that will be run at the client side, and this client side script will call the function "koko()" from the server side. in brief : i want to call a server side function from a client side script... can you help me in this You can't call server-side code directly from client-side code. You can, however, trigger a postback that your server-side code watches for and triggers the server-side code appropriately. You can do some ...

Calling a server-side procedure from a client-side function
I have a server side function that executes a database stored procedure, and I need to be able to call it from a javascript function.  Is this possible (without using an iFrame)?  Post back the page or use Ajax. Eric Pascarello.com | Twitter epascarello | LinkedIn...

Call server side function from client side javascript
I have a javascript where I either need to call an onclick even of a server link button or I need to be able to call a server side function.   The only thing is I cant use AJAX.  Is there any way I can do this or am I spinning my wheels. Thanks!-------------Please: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue. I have a similar problem.  In my case, I would like to set a server-side session object from JavaScript.  Any suggestions?  Thanks.  Dan Sure, y...

Web resources about - Call Server Side methods from Client Side - asp.net.ajax-discussion

Decoding methods - Wikipedia, the free encyclopedia
... and coding theory , decoding is the process of translating received messages into codewords of a given code . There have been many common methods ...

Hospital occupancy rates fall to record lows - but a new counting method was used
ACT government says comparisons cannot be made to previous results, then trumpets 'improvements'.&nbsp;

Distirbutional impacts of different cost share methods
There is a really good set of discussions about plan design and benefit configuration going on. Andrew Sprung at Xpostfactoid has a good series ...

How to Build a Billion Dollar Company: The Method Behind Today's "Unicorn" Madness
The most recent Unicorns are being developed in as little as 36 months, with the combination of strong Founders, forward-thinking investors, ...

4 Mad Methods for Making Your Brand Stick Out
If you want to come out and make a name for your business, you got to get a little weird.

The Last-Ditch Fertilization Method For Infertile Men Just Got More Reliable
... can’t manage the arduous swim across a Petri dish have had the option of injecting a single sperm cell directly into an egg. But that method ...

Manchester United news: Smalling praises Van Gaal's methods - Goal.com
The defender says the club's impressive defensive displays are the result of the coach's training methods

Mutant Mosquito To Combat Malaria — New Method Revolutionizes Tweaking Of Genes, Which Could Save Other ...
Scientists have created mutant mosquitoes to combat malaria. However, the method used to tweak the genes could revolutionize the way genes are ...

The Ten Most Bizarre Shipping Methods
In some parts of the world, those 30+ year-old Grumman LLVs just don’t do the trick. That’s where these ten bizarre modes of shipping mail (and ...

California proposes new single-drug method for executions
Los Angeles Times California proposes new single-drug method for executions Los Angeles Times A view of the lethal injection chamber at San ...

Resources last updated: 11/25/2015 10:24:02 AM