Michael Tot Korsgaard
Michael Tot Korsgaard

Reputation: 4014

Having runat=server running at client

First question: Im creating a website, and everytime I have a method activated, my page reload. All my methods runs at the server (They are all ASP.NET codebehind functions). But I would like to have them running at the client, without the client being able to see, or at least have them running without refreshing the page everytime. Is that even possible?

Second question: Some people say that it is possible through javaScript, but does the call the function at the server, or does it simply convert the method to running at the client for everyone to see. If its the first, then where can I find a full guide to make this happen. And is it recommended.

Upvotes: 0

Views: 121

Answers (1)

Amiram Korach
Amiram Korach

Reputation: 13296

You have two options:

  1. Use ajax to call the server but without a postback so the user won't see it. The method still runs in the server. To use ajax you can go the easy way with UpdatePanel or the more better way with jquery ajax and ScriptMethod in the client, see here a sample

  2. Convert your code to javascript code and run it in the client. You can't convert everything to client only, for example you can't access your database in the server without going to the server.

Upvotes: 3

Related Questions