Saturday, 10 December 2011

First a very Simple Page in Asp.net using List Control to display Item Dynamically


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SimpleWebSite._Default" %>

<script runat="server">
const int ItemCount=10;
String GetDisplayItem(int n){

return "TahirListItem#"+n.ToString();
}  
</script>

<!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>Tahir Khalid Simple Asp.net in C# Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <ul>
    <% for(int i=0; i<ItemCount;i++ ){ %>
    <li><%=GetDisplayItem(i) %></li>
    <%}%>
    </ul>
    </div>
    <%Response.Write("<h3>Total Number is the Tahir List=" + ItemCount.ToString() + "</h3>"); %>
    </form>
</body>
</html>

No comments:

Post a Comment