Could I write a javascript code on code behind page

Posted by Fahadullah1 under ASP.NET on 11/7/2012 | Points: 10 | Views : 1608 | Status : [Member] | Replies : 3
Could I write a javascript code on code behind page




Responses

Posted by: Saratvaddilli on: 11/7/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Ya we can write java script code in the code behind

Thanks and Regards
V.SaratChand
Show difficulties that how difficult you are

Fahadullah1, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sourabh07 on: 11/7/2012 [Member] Starter | Points: 25

Up
0
Down
hi...

write the following code whereever you want to use javascripting in the code behind page.....

eg: I am using alert during page load.......

protected void Page_Load(object sender, EventArgs e)

{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "any_msg", "javascript:alert('Hello');", true);
}


Sourabh07

Fahadullah1, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Johnbhatt on: 11/7/2012 [Member] Starter | Points: 25

Up
0
Down
Yes, you can Write your JavaScript code in backend.

Example

Response.Write("<script>alert('This alert is Coded in Backend file and will not be visible in Front End, View Source in Browser.');</script>");


John Bhatt
Glad to Know, Free to Share.....
http://www.johnbhatt.com

Fahadullah1, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response