Al-Gomgoma
New Member
i want to use my sql table result to create table in aspx page and fill table row , columns and cells on my web page i divide my problem in to 3 steps which are in images below.
!this is the 2,3 step
this is my code to show resultits ok to show just step 1\[code\] DataClassesDataContext conx = new DataClassesDataContext(); var resulttable = from s in conx.tbl_UserAnswers group s by s.Matrixy into g select new { rowKey = g.Key, rowData = http://stackoverflow.com/questions/13738825/g.Select(s => new { result = s.result, Amount = s.landa })//.OrderBy(s => s.Product.Label) }; // Create a new HtmlTable object. HtmlTable table1 = new HtmlTable(); HtmlTableRow row; HtmlTableCell cell; foreach (var tableRow in resulttable) { // Create a new row and set its background color. row = new HtmlTableRow(); foreach (var sale in tableRow.rowData) { // Create a cell and set its text. cell = new HtmlTableCell(); cell.InnerHtml = sale.result.ToString(); tableRow.rowKey.Value.ToString();//"Row: ";//+ i.ToString()+ "<br />Cell: " + j.ToString(); // Add the cell to the current row. row.Cells.Add(cell); } // Add the row to the table. table1.Rows.Add(row); } // Add the table to the page. myPlaceHolder.Controls.Add(table1);}\[/code\]