Click here to Skip to main content
15,906,624 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in my application i am adding table dynamically and bind data in table. i want after display 3 record in same line of page next record would be display on next line not in same line means every tr display 3 record after that it display on next line. below i m write code









protected void Page_Load(object sender, EventArgs e)
    {
        //DataTable dt = new DataTable();
        SqlConnection con = new SqlConnection();
        con.ConnectionString = ConfigurationManager.ConnectionStrings["ConnStringDb1"].ConnectionString;
        SqlCommand cmd = new SqlCommand("select divhtml_content from content_managment where page_id = '3'", con);
        DataTable dt = new DataTable();
        SqlDataAdapter ad = new SqlDataAdapter();

        ad.SelectCommand = cmd;
        ad.Fill(dt);
        table1.Rows.Clear();

        HtmlTableRow tr = new HtmlTableRow();
      
        foreach (DataRow dr in dt.Rows)
        {
           
               
                HtmlTableCell tc = new HtmlTableCell();
                // tc.Width = "100px";
                tc.InnerHtml = dr["divhtml_content"].ToString();
                tr.Cells.Add(tc);
                table1.Rows.Add(tr);
            }
            // do something with each row in the results...
        
          
        
    }
Posted

1 solution

I solved my problem its so easy but logic is so difficult
 
Share this answer
 
Comments
Sandeep Mewara 14-Jun-12 8:00am    
This is not an answer. Instead, update this with whatever resolved your issue. This would help others in future if they face similar issue.,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900