Is C# using any Scripting language for Events?
asp.net, c#, c#-4.0
Solution
It's not a language thing, it's a framework/technology thing. For example, ASP.net web forms can handle events in the code behind similar to how you would in a windows application, but it's really just wrapping http requests. In MVC (which is also C#), you deal with page "events" by interacting with the controller using your standard http verbs (get, post, put, delete, etc).
I'd tell him that php doesn't handle events either in that case. Since both php and asp are server side languages, they all respond to http requests, not events. But clicks tell the browser to do stuff and communicate with the server. javascript would handle events and then communciate with the server, but the point is, his argument is a bit mixed up.
Other answers:
- Runat server just tells asp that you want to use this object on the server, so it creates some objects and references to html elements so that you can interact with them in the server side code.
- Yes
- Windows isn't using a scripting language. Your asp application is using whichever language you programmed it in. However, ASP.net does generate some javascript in order to emulate windows desktop programming styles.
- Response.Redirect happens on the server side, it just tells the framework to build an object that will translate to a proper HTTP response.
You might want to study up on some of the basics of web development. Specifically how http is statless and how http verbs work. It's easier to understand what the framework is doing when you understand what is happening when you're NOT using a framework.
UPDATE: After the edits, I re-read your post and I see what the issue is. Your friend is mostly right. C# isn't a client side language, so it can't react to page events -- so he's correct there. However, what ASP.net does is generate javascript that bridges this gap. Conversely, ASP/MVC doesn't do this, so you'd have to write the javascript (or even just basic form submissions) that would talk to the controller, and then you would have to handle the server response accordingly.
So he is right, you can't directly write C# code to respond to page events. But if you develop in C# using ASP.net, it will allow you to code in C# and generate the necessary javascript for you. It'll be mostly seamless from your point of view.
Problem
One of my friend (a php developer) told me that C# doesn't have the capacity for managing events, means events are not generated or not controlled by C# codes (Like `Button Click`, `Selected Index Changing` etc). Its by some other scripting language like `JavaScript` and he told me its `JScript`. And that all the controls like labels, buttons are client side and doesn't need to go in to server. Then my question is Why `runat="server"` for all asp controls? He also told that redirection (Response.Redirect) is also happening in client side, its not server side and `C#` don't have the ability to do so because its a `PROGRAMMING LANGUAGE` not a `SCRIPTING LANGUAGE`. I am totally confused with his Answer and I am not satisfied with his answer. Can some one tell me what it is? - What is `runat="server"`? And what if all controls are client side? - Does c# have the ability to Redirect, Event Generation, handling etc? - If c# doesn't have the ability then which scripting language is windows using? And how it works independent to browser? - What about `Response.Redirect`? Is it client side ? Then how it works? - Does `ASP` using any `Scripting language` for `events` ? I am new to `C#`. May be this is poor question but can someone give proper answer? I am totally confused. By events means, Events like Button_Click,SelectedIndexChanged etc And i mentioned C# here because i am using C# , Thank you