When i read on MS press, it provide example like this, but when i try it on visual studio 2005, it show the % is invalid character. Anyone can comment about this? Thanks in advance.
<% Dim I As Integer
For I = 0 to 7 %>
<font size="<%=I%>"> Welcome to ASP.NET </font> <br/>
<% Next %>
Hi, where did you put it? I created a Visual Basic 'ASP.NET Web Site', and added the code to Default.aspx as following and it worked fine:
<%@. Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<% Dim I As Integer
For I = 0 to 7 %>
<font size="<%=I%>"> Welcome to ASP.NET </font> <br/>
<% Next %>
</div>
</form>
</body>
</html>
Hi, thanks for reply. I put it below pageload. After i read yr post, i paste under <body>, it also show error msg for dim, next and font. For dim, it said expression needed, while under next, it said a not declared, for font it said "validation (XHTML1.0 Transitional), element font is considered outdated, a new construct is recommended.
Why this happen? Thank you.
this is the code
<
div> <asp:LabelID="msg"runat="server"Height="48px"Style="z-index: 100; left: 48px;position: absolute; top: 26px"
Width="119px"></asp:Label><%
#Dim aAsIntegerFor a = 0To 7%><fontsize="<%=a%>"> Welcome to ASP.NET</font><br/><%
Next %></div></form>hi, it's ok already, just leave the font but the application can run. But i have a question, font is outdated?
Yes the font element is outdated. Please see my post in the FAQ about deprecated items:
http://forums.asp.net/thread/1291684.aspx
OK, but which of these:
· color
· font-family
· font-size
· text-decoration
· text-align
· text-indent
· text-transform
· font-weight
Replaces:
<Font class="mytestformat">
For an ASP Sever Control it is typically the CssClass property
<asp:Label CssClass="mytestformat">
Or for an html object it is just in it's class
<div class="mytestformat">...</div>
Putting a class attribute in a font element is actually counter intuitive since the font element is meant to control fonts (size, color, etc.) but css classes can do far far more.
0 comments:
Post a Comment