Click here to Skip to main content
15,889,878 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all
having some kind of logical error regarding not showing table.row.border
here is my code
C#
Table mytable = new Table();
            for (int i = 0; i <= 9; i++) { 
            TableRow myrow = new TableRow();
            myrow.ID = "row" + i.ToString();
            for (int j = 0; j <= 3; j++) {
                TableCell mycell = new TableCell();
                mycell.ID = "cell"+i.ToString() + j.ToString();
                mycell.Text = "cell" + i.ToString() + j.ToString();
                //mycell.BorderWidth = 1;
                myrow.Cells.Add(mycell);
                
            }

            myrow.BorderWidth = 1;
                mytable.Rows.Add(myrow);
                
            }

            //mytable.BorderWidth = 1;
            form1.Controls.Add(mytable);

please have a look in to this
thanks
Posted
Comments
AshishChaudha 11-Jul-12 6:36am    
is this problem solved?? mark solution so that other can refer to the solution..
Thanks
mehdilahori 19-Jul-12 1:02am    
hi ashish
mot solved yet

Try this..working fine


C#
Table mytable = new Table();
        for (int i = 0; i <= 9; i++)
        {
            TableRow myrow = new TableRow();
            myrow.ID = "row" + i.ToString();
            for (int j = 0; j <= 3; j++)
            {
                TableCell mycell = new TableCell();
                mycell.ID = "cell" + i.ToString() + j.ToString();
                mycell.Text = "cell" + i.ToString() + j.ToString();
                //mycell.BorderWidth = 1;
                myrow.Cells.Add(mycell);
                mycell.BorderWidth = Unit.Point(2);
            }
            myrow.BorderWidth = 1;
            mytable.Rows.Add(myrow);
        }

        //mytable.BorderWidth = 1;
        frm.Controls.Add(mytable);
 
Share this answer
 
Comments
mehdilahori 19-Jul-12 1:03am    
mot solved yet
C#
Table mytable = new Table();
            for (int i = 0; i <= 9; i++)
            {
                TableRow myrow = new TableRow();
                myrow.ID = "row" + i.ToString();
                for (int j = 0; j <= 3; j++)
                {
                    TableCell mycell = new TableCell();
                    mycell.ID = "cell" + i.ToString() + j.ToString();
                    mycell.Text = "cell" + i.ToString() + j.ToString();
                    mycell.BorderWidth = Unit.Point(2);
                    myrow.Cells.Add(mycell);

                }

                myrow.BorderWidth = 1;
                mytable.Rows.Add(myrow);

            }

            mytable.BorderWidth = Unit.Point(3);
            form1.Controls.Add(mytable);

pass border width with Unit
 
Share this answer
 
Comments
mehdilahori 19-Jul-12 1:04am    
mot solved yet
Hi,
Declare a class using style index
.rowStyle
{
border:1px solid Green;
}

and add styles while adding the cells
myrow.attributes.add("class","rowStyle");

Thanks:
Buy Lace
 
Share this answer
 
Comments
Nagy Vilmos 7-Jul-12 15:16pm    
I for the spam link.
mehdilahori 19-Jul-12 1:04am    
mot solved yet

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