ASP.net code C# วน loop + set ขนาดตัวอักษร
posted on 02 Oct 2009 15:35 by techinnoreview in MITTusing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Loop : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "";
//เช็คใส่ชื่อนักฟุตบอลไม่เกิน 32 คน
int i;
for (i = 0; i < 32; i++)
{
Label1.Text+= "<font size=" + i + ">ขนาดตัวอักษร" + i + "</font><br/>";
}
}
}
ฝั่งเว็บ
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Loop.aspx.cs" Inherits="Loop" %>
<!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></title>
</head>
<body background="easter_wallpaper_61.jpg">
<form id="form1" runat="server">
<div>
LOOP</div>
<p>
</p>
<p>
</p>
<asp:Label ID="Label1" runat="server" Font-Bold="True" Text="Label"></asp:Label>
</form>
</body>
</html>