Click here to Skip to main content
16,012,116 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi ,

What is the use of calling javascript from codebehind.
We can call javascript from clientside source.

thanks.
Posted
Comments
Sergey Alexandrovich Kryukov 30-Nov-12 0:26am    
Not quite a valid question. How the first statement (add a question mark, at least) related to the second one.
--SA
Sergey Alexandrovich Kryukov 30-Nov-12 13:33pm    
If you know what is executed on what side, perhaps you don't know what a call is... :-)
Anyway, I generally explained how it works in my answer -- please see. Everything else is just based on it. Now, depending on what do you need, you can develop some functionality, but without the "calls" you mentioned. It's not that it's impossible, the notion itself makes not sense. It works in different ways...
--SA
[no name] 30-Nov-12 0:27am    
Your question is not clear and not written properly... Please elaborate your question as er your requirements..
Sergey Alexandrovich Kryukov 30-Nov-12 0:33am    
I don't think it worth elaboration, because it already contains a misconception which renders the rest of it making no sense. OP just needs to learn what Web actually does; please see my answer.
--SA

1 solution

The question is also incorrect because "codebehind" never ever calls JavaScript.

How do you think it could do such call? "Codebehind" is something executed on server part, and JavaScript is executed in the browser hosting the interpreted. You need to learn what Web application does and how HTTP works. What really happens is: ASP.NET code works in response to HTTP request. As a result, it generates some HTTP response, which is sent back to the client. That's it. Now — attention — HTTP response can be anything. In particular, it can be (and most typically is) some HTML file with JavaScript. JavaScript code is simply generated on the fly, and its text is composed on the fly, which might give you "impression" of the call. In fact, it is executed solely on the client side.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900