Monday, 12 August 2013

creating dynamic div tag and place the data in that div tag, the data which is fetched from the database

creating dynamic div tag and place the data in that div tag, the data
which is fetched from the database

I have created dynamic hyperlink and fetched data from database. now i
need to put those data in particular div tag. Please help me. Thanks in
advance.
<div runat="server" id="bdy">
</div>
protected void Page_Load(object sender, EventArgs e)
{
MySqlCommand inscmd = new MySqlCommand("select * from category", con);
MySqlDataAdapter a = new MySqlDataAdapter(inscmd);
DataTable t = new DataTable();
foreach (DataRow row in t.Rows)
{
bdy.InnerHtml.Equals("<a href=\"category.aspx?refid=" +
row["cid"] + "\">" + row["catname"] + "</a><br />");
// bdy is div name
Response.Write("<a
href=\"category.aspx?refid="+row["cid"]+"\">"+row["catname"]+"</a><br
/>");
}
}

No comments:

Post a Comment