Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have developed a webpage which contain a dynamically changable table the code i used i shown below :

string dynTable = "";
            dynTable = "<table  ID=\"tablechange\" cellspacing=\"0\" cellpadding=\"2\" border-collapse: collapse\">";
            for (int TableRows = 0; TableRows < finalrow; TableRows++)
            {
                dynTable += "<tr>";
                for (int TableColumns = 0; TableColumns < 5; TableColumns++)
                {
                    if (x <= count) break;
                    dynTable += "<td style=\"color: Black; width: 100px; border-color: #000000; border-style: solid none solid solid;\">"; dynTable += Display[count, 0]; dynTable += "</td>";
                    dynTable += "<td style=\"color: Black; width: 35px; border-style: solid solid solid none; border-color: #000000;\" title=" + Display[count, 2] + " bgcolor=" + Display[count, 1] + ">"; dynTable += ""; dynTable += "</td>";
                    dynTable += "<td style=\"width: 2px\">"; dynTable += "</td>";
                    count++;
                }
                dynTable += "</tr>";
                dynTable += "<tr>";
                dynTable += "<td style=\"height: 2px;\"></td>";
                dynTable += "</tr>";
            }
            dynTable += "</table>";
            Literal1.Text = dynTable;



when i debug in web developer the table is being displayed as intended with border and everything bus where as when i host the webpage in asp.net the border seem to be missing i have put a link for ur better visualisation top pic show the one when i debug and secodn one shows after i host it in iis

http://img841.imageshack.us/i/unledjb.png/[^]

They idea on what i wrong pls help =)
Posted
Comments
Sandeep Mewara 14-Apr-11 0:42am    
Do a ViewSource of the page and see what is rendered as a table. Re-check it and accordingly try to look at what is missing?
R. Giskard Reventlov 14-Apr-11 3:29am    
Apart from anything else this is a messy way to do this. If you are going to push mark-up out at least use a StringBuilder. What you should attempt is to create a Table object. Create TableCells and add them to a TableRow then add the TableRow to the table and push the table out to a PlaceHolder. You can populate the attributes of the Table, Row and Cells as required. What you have above is a mess.
Karthik. A 14-Apr-11 13:05pm    
may be because you don't have the border-style in all the td's? and I advice you to use StringBuilder or use asp:Table and add to it dynamically.

1 solution

for one thing you are missing style=' before border-collapse: collapse at the table tag. I think that might fix it. I put border='1' style='border-collapse: collapse' in the table tag. and the border shows up.
 
Share this answer
 

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