Tuesday 6 May 2014

How to bind Table in asp.net?

example:
public DataSet ds;

protected void Page_Load(object sender, EventArgs e)
{
    ds = new DataSet();
    //load your ds from database
}
Following is the code to use table 0 from database to create table in aspx
<table>
<% foreach(DataRow row in ds.Tables[0].Rows) { %>
<tr>
<td><%= row["columnName"] %></td>
</tr>
<% } %>
</table>
Hope this helps

No comments:

Post a Comment