i want to retrive data from my database in form of table .i want that rows should be generted at the run time using loop and my data is displayted in form of table plz help.
Asp
hello ,
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Alok UniyalRank #8,369 · 223 reputationPosted Jun 19, 2013, 12:22 AM EDT
You are developing a window or web application?
ashima kukreja19 reputationPosted Jun 19, 2013, 12:27 AM EDT
Alok UniyalRank #8,369 · 223 reputationPosted Jun 19, 2013, 12:34 AM EDT
First add asp:Table control in your web page where you want to display it.
Let you add a table with id "tbl"
On pageload event do this-
SqlConnection con = new SqlConnection(*/Your Connection*/);
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "Select * from Test";
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.HasRows)
{
TableRow tr = new TableRow();
while(rdr.Read())
{
string rowdata = rdr[0].ToString();
TableCell tc = new TableCell();
tc.Text = rowdata;
tr.Cells.Add(tc);
}
tbl.Rows.Add(tr);
}
con.Close();
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Jun 19, 2013, 12:35 AM EDT
Jignesh TrivediRank #16 · 50.3K reputationPosted Jun 19, 2013, 1:04 AM EDT
In this case you can use Jquery grid.
Please refer
http://jquerygrid.net/
http://www.jquery4u.com/plugins/10-jquery-grids/
if you are framework 4.5 user than SignalR can be help you.
Pankaj PandeyRank #642 · 3.7K reputationPosted Jun 19, 2013, 1:35 AM EDT
Is any specific requierment?