如何增加表格单元格的宽度(通过动态表格) [英] how to increase the table cell width (through dynamic table)

查看:127
本文介绍了如何增加表格单元格的宽度(通过动态表格)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

foreach (string item in list)
            {

                for (int i = 0; i < 1; i++)
                {

                    TableRow row = new TableRow();
                    for (int j = 0; j < 2; j++) // Loop for Column
                    {
                        TableCell cell = new TableCell();
                                                                  
                        Label lbl = new Label();
                        lbl.Text = item;
                        cell.Controls.Add(lbl);                                               

                        TextBox tb = new TextBox();
                        tb.ID = "txtBox1" + i.ToString();
                        RequiredFieldValidator reqfldVal = new RequiredFieldValidator();
                        reqfldVal.ID = "RequiredValidator" + i;
                        reqfldVal.ControlToValidate = "txtBox1" + i;
                        reqfldVal.ErrorMessage = "Not Empty";
                        reqfldVal.SetFocusOnError = true;
                        cell.Controls.Add(tb);
                        row.Cells.Add(cell);
                    }
                    k++;
 
                    table.Rows.Add(row);

                    
                }   
            }



在这里,我在单元格中同时添加了标签和文本框.如何分隔两个单元格.
TableCell cell = new TableCell();



here i am add both lable and textbox in cell. how to separate two cells.
TableCell cell = new TableCell();

推荐答案

您可以使用以下方式设置表:


you can set the tables with like this:


TableCell cell = new TableCell();
cell.Width = 100;



这样,您可以根据需要增加表的数量.



That way you can increase your table as much as you want..



尝试这样

hi
try like this

TableCell cell = new TableCell();
td.Width = Unit.Percentage(100);



祝一切顺利

谢谢与问候
Sandeep



All the best

Thanks&&Regards
Sandeep




由于您已经创建了动态表格,因此您可以设置相同的属性...请注意....


as u have make a dynamic table, so u can set properties for the same...please use ur mind....


这篇关于如何增加表格单元格的宽度(通过动态表格)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆