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 Guccione
Genova, Italy
0
lucaguccione
10/22/2008 12:56:27 PM
asp.net.client-side 24353 articles. 2 followers. Follow

4 Replies
2169 Views

Similar Articles

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

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
0
zahsot
10/22/2008 1:50:10 PM

lucaguccione:

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

 

The only way is by using AJAX or a PostBack.

NC...

 

0
NC01
10/22/2008 2:24:29 PM

HI lucaguccione

I agree with NC, the link post by zahsot show us how to do an AJAX call by jQuery, not really "directly".

Thanks.


Lance Zhang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Lance
10/27/2008 11:20:22 AM

Lance Zhang - MSFT:

HI lucaguccione

I agree with NC, the link post by zahsot show us how to do an AJAX call by jQuery, not really "directly".

Thanks.

It also doesn't relate very well to a novice as 1. You need to understand AJAX and 2. you need to know JQuery, neither being that easy for even veterans in web applications.

NC...

 

0
NC01
10/27/2008 12:06:19 PM
Reply:

Similar Artilces:

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...

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.  RegardsSreenivas. 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...

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...

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 a client side control event from a server side function
I would like to know how to raise an event on a client side only control from a server side function.   For example, I have Button1 whose onclick is handled at the server. The logic behind the function will do 1 of 2 things, change the text of a label to indicate a problem or navigate to a new page.  I cannot use redirect because i need the new page to appear inside 2 of 3 existing frames.  I can manage this using an anchor on the client.  All I need to do is automatically click the anchor after I post back from the Button1.click event.I tried the following line of c...

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...

Help with client side events Vs. server side events
Hi, Can someone look as the following script and tell me why marking the check box doesn't generate a client side event eventhough there's: onclick="checkClick()"? marked.  Thanks in advance, Sivan <%@ Page Language="c#" %><HTML> <HEAD>  <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body>  <SCRIPT language="c#" runat="Server">  void Page_Load(object s, EventArgs e) {  if (!Page.IsPostBack)  {   Label1.Text = Label...

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...

Client Side events and Server side binding
I want to filter a dataset, server side and bind it to a select control. Problem is my filtering must be done based on the text written by the user in a text input. To get this text i'm using client side keyboard events. I tried to use client side binding and it works fine, but the problem is my dataset has more than 10000 rows, and so the performance is awful. Only thing i can do i think is to rebind the select control to a filtered dataset, improving performance. This is my code at the moment: In the aspx: static HtmlSelect _control = null; [WebMethod(EnableSession = true)] publi...

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...

Client side/server side event race.
 Hi.  I've got a page that 1) Takes some text fields as input2) Does some math calculations on the input (server side via a "calculate" button click)3) Then opens a new window with some detailed information (client side, via a "view report" button click)The server needs to "calculate" before the user can click "view report" so I start with "view report" disabled.  I've got input validation on the "calculate" click, and at the end, I enable the "view report" button.  Everything is working well wi...

Server Side or Client Side
Hi I'm a bit confused about this whole server side / client side thing. Are applets, embeded objects consider client side? If I have a form within my aspx page which connects to a database on the server side what is it considered? If I have some business logic written within a VB file when the client access the functions within that business logic (for example some kind of validation function) does the client browser actually downloads that VB file? Can someone suggest how to differentiate between client side and server side components within a asp.net based website?  Hi, i can&#...

Web resources about - Calling server-side methods from client-side event - asp.net.client-side

Server-side scripting - Wikipedia, the free encyclopedia
... unfocused, scattered, unnecessary details. WikiProject Technology or the Technology Portal may be able to help recruit an expert. Server-side ...

Google Cloud Platform simplifies server-side development for iOS w/ ‘Mobile Backend Starter’
... Mobile Backend Starter that first debuted for Android developers back in June. Google says the application helps to simplify the server-side ...

Free Cooling: the Server Side of the Story
Servers that support higher inlet temperatures could significantly reduce or even eliminate the cooling costs of the data center. We received ...


[Update: Check Now] Play Store For Android Gets Search Bar With Hamburger Flip In Server-Side Update
Google is pushing out an update to the Play Store's Android interface that replaces the action bar with a standard search bar. Inside are the ...

Server-side update makes Siri a stickler for succinctness
Siri is already well known for her wit and willingness to joke, but a recent server-side update has given Apple's digital assistant the ability ...

Japanese RIAA wants server-side music DRM for mobile phones
The Recording Industry Association of Japan—the Japanese version of the RIAA— …

New BaaS platform aims to eliminate writing server-side code
... offering for desktop and mobile developers that's now leaving its beta phase. By removing the need for writing code on the server-side, Backendless ...

Dart improves async and server-side performance
... Team Today's release of the Dart SDK version 1.3 includes a 2x performance improvement for asynchronous Dart code combined with server-side ...

Customize Google Using Server-Side Scripts
Google's services have a lot of powerful features, but they can't offer all the options requested by users. A popular way to customize Google ...

Resources last updated: 1/21/2016 11:01:58 AM