Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic JavaScript in ASP.NET

Status
Not open for further replies.

shadyness

MIS
Dec 21, 2001
89
0
0
US
What is the ASP.NET 2.0 approach for dynamic in-page JavaScript? I use themes and set other things programmatically like meta data in the MasterPage code behind file.

But what is the best way to approach complicated in page JavaScripting that has server-side session variables set into it? Do you have to do it in the page mark-up still? Or is there a code-behind approach to this?

The classic ASP:
Code:
<script language="JavaScript" type="text/javascript">
  var somevar = <%=session("sessionvar")%>; 
</script>

<== Some people say they are afraid of heights. With me its table widths. ==>
 
Have a look at the RegisterClientScriptBlock and the RegisterStartUpScript menthods. They are part of the ClientScript class in version 2.0 of the framework and in the Page class for previous versions.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
That's it. I knew there was an answer for that.

Thanks much. After I made the jump from ASP 3.0 to ASP.NET 1.1 I thought that much of what was developed was kind of counter-intuitive or at best not an improvement over old development architecture.

2.0 is just sh*t hot. I am loving developing in this environment.


<== Some people say they are afraid of heights. With me its table widths. ==>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top