Friday, October 3, 2014

Using the DataList Control with ASP.NET 4.0 and c#

11:06 AM - By azeheruddin khan 0

Using the DataList Control with ASP.NET 4.0 and C#



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
       protected void Page_Load(object sender, EventArgs e)
        {

            if (!Page.IsPostBack)
            {
                DataTable objDataTable = new DataTable();
                objDataTable.Columns.Add("Range");

                DataRow objDataRow;
                for (int i = 0; i <= 1000; i++)
                {
                    objDataRow = objDataTable.NewRow();
                    objDataRow["Range"] = i.ToString();
                    objDataTable.Rows.Add(objDataRow);
                }

                DataListRange.DataSource = objDataTable;
                DataListRange.DataBind();
            }

        }



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
   <asp:DataList ID="DataListRange" runat="server">
        <HeaderTemplate>
            <table>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <%# Eval("Range") %>
                </td>
            </tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:DataList>




About the Author

I am Azeheruddin Khan having more than 6 year experience in c#, Asp.net and ms sql.My work comprise of medium and enterprise level projects using asp.net and other Microsoft .net technologies. Please feel free to contact me for any queries via posting comments on my blog,i will try to reply as early as possible. Follow me @fresher2programmer
View all posts by admin →

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

adsense

© 2014 Fresher2Programmer. WP Theme-junkie converted by Bloggertheme9
Powered by Blogger.
back to top