...

View Full Version : What is runat really for?



jaywhy13
01-13-2005, 11:30 PM
What can i do with script runat="server", really......

gwendaal
01-14-2005, 12:55 AM
you can use a normal
<div>hello</div>

or
<div id="div1" runat="server" />


and on codebehind

div1.text = "hello"

you cannot do that with the first one

jaywhy13
01-14-2005, 02:30 AM
How about <script runat="server">?

gwendaal
01-14-2005, 07:26 AM
<%@ Page Language="VBScript" %>

<script runat="server">
Sub Page_load (Obj As Object, E As EventArgs)
your code here
End Sub
</script>

<html>
<body><form id="frm" runat="server">
........ your page content here
</form></body>
<html>


u use it when you write the code imto the aspx page directly

I myself never use it

in sted you have better to do >>>

<%@ Page Language="VBScript" Codebehind="default.aspx.vb" Inherits="yourNameSpaceRoot.webSite.defaultPage"%>

and write your server code into the default.aspx.vb page

Codebehind="default.aspx.vb" is only using Visual Studio

otherwise you must write >>> Src="default.aspx.vb"


but <%@ Page Inherits="yourNameSpaceRoot.webSite.defaultPage"%>
works too if you don't work with design

jaywhy13
01-14-2005, 01:06 PM
:confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused:
Okay..... can you now answer the question in the rookie version?

I'm new to ASP and thats just classic ASP mind you, and i wanna know what this can do before I soak my hands into ASP.Net



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum