narasiman rao

narasiman rao

  • NA
  • 519
  • 747.2k

create div dynamically using database

Dec 23 2015 10:16 PM
 
 i want to create dynamically div using database

In database record as follows
In LatestNewsMaster table record as follows

ID Subject          Description                         Link
1  Accounts     Accounts fee page            Accountsfees.aspx
2 Defects        Defects mail report              Defects.aspx

my code as follows

string constr = ConfigurationManager.ConnectionStrings["Reception2_DB"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
sing (SqlCommand cmd = new SqlCommand("select Subject,Description,Link from LatestNewsMaster where active <> 'd'"))
{
cmd.Connection = con;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
DataTable dt = new DataTable();
sda.Fill(dt);
for (int i = 0; i<dt.rows.count;> {
lblSub.Text += dt.Rows[i][0].ToString().Trim() + "
";
lbldesc.Text += dt.rows[i][1].ToString().Trim() +"
";
llbLink.Text += dt.rows[i][2].ToString().Trim() + "
";
}
}
}


When i run the above code output as follows

Accounts       (Subject Displayed from the database)
Defects          (Subject Displayed from the database)
Accounts fee page      (Description Displayed from the database)
Defects mail report     (Description Displayed from the database)
Accountsfees.aspx      (Link Displayed from the database)
Defects.aspx              (Link Displayed from the database)

But i want the above ouptut to be displayed as follows

Subject            Description                         Link
Accounts           Accounts fee page          Accountsfees.aspx
Defects             Defects mail report          Defects.aspx
 

Answers (2)