jQuery and JavaScript can manipulate DOM like anything. But if C# has to send something to the client, then in my knowledge, we can only user Response object to write something in the browser. Now, this would write text in the browser, but we do not have control over where would it write it. Is there anyway that we can control from C#, somehting like :
“This is the text and I want it to be innerHTML of some particular DIV”?
You have two ways to go about doing something like this.
runat="server"and then it’s accessible from the back end to manipulateClientScriptManager.RegisterClientScriptBlockand manipulate the div that way.But also as Chuck has mentioned in his comment – that’s a rather odd thing to do in ASP.NET. For the most part you’d use Label, Literal etc. server controls to add and manipulate text on a page instead of modifying native DOM elements directly.