asp.net consultancy chorley ASP.NET Server Side Scripting Wigan
Website Development Radcliffe

IT Services And Support

Email : ren@techsolus.co.uk
Mobile Phone : 0788 68 41 411
Answerphone : 01204 469683
bespoke invoice systems Standish Information Technology Advice Worsley
    development systems Ramsbottom
data manipulation Farnworth access databases Whitefield SQL connections Atherton
online accessible software Leyland software compatible Coppull


Get connected and Online Tottington
remote management Makerfield code and design Aspull

ASP.Net - What's the #(hash) for or mean? - 04/05/2011

I've been doing ASP and ASP.Net for over 10 years now...and I still don't know much.

Take the following code example.

<script runat = "server">

dim mydate as datetime

sub page_load

end sub

</script>

<html>
<head>

<title>
 Test
</title>

</head>
<body>

<% response.write(mydate) %>

</body>
</html>

If you view this page you will see the following

01/01/0001 00:00:00

Yet if we alter the page as below

<script runat = "server">

dim mydate as datetime

sub page_load

end sub

</script>

<html>
<head>

<title>
 Test
</title>

</head>
<body>

<%# mydate %>

</body>
</html>

The page will simply come up blank.

This is the bit that has changed -

<% response.write(mydate) %>
became
<%# mydate %>

What is going on here?  Being familiar with ASP as well as ASP.net the <% %> means this code is run as part of the page, where as <%# %> means speak this, do this.  To be honest, I don't know.  More research required...

Post A Comment

Name Comment
programming services asp.net specialist
Valid XHTML 1.0 Transitional
Admin
GD