文本框如何在表格中放置第二列 [英] Textbox how to place second column in table

查看:77
本文介绍了文本框如何在表格中放置第二列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

foreach (string item in valueslist)
                    {
                        
                        TableRow tr = new TableRow();
                        TableCell tc = new TableCell();
                        Label lb = new Label();

                        TextBox tb1 = new TextBox();// this textbox is place table in second column.
                        tb1.ID = "tb" + i.ToString();


                        lb.Text = item;
                        string ids = string.Format("lb{0}", i);
                        lb.ID = ids;
                        tc.Controls.Add(lb);
                        tr.Controls.Add(tc);
                        table.Controls.Add(tr);
                        tc.Controls.Add(tb1);

                                            

                        i++;
                    }

推荐答案


检查此
Hi ,
Check this
int i = 1;
      foreach (string item in lst)
      {
          TableRow tr = new TableRow();
          TableCell tc = new TableCell();
          TableCell col2 = new TableCell();

          Label lb = new Label();
          lb.Text = item;

          TextBox tb1 = new TextBox();// this textbox is place table in second column.
          tb1.ID =  "txt"+i;
          tb1.Text = "col2";
          string ids = string.Format("lb{0}", i);
          lb.ID = ids;
          tc.Controls.Add(lb);
          col2.Controls.Add(tb1);

          tr.Controls.Add(tc);
          tr.Controls.Add(col2);


          Table1.Controls.Add(tr);

          i++;
      }


最好的问候
米特瓦里(M.Mitwalli)


Best Regards
M.Mitwalli


这篇关于文本框如何在表格中放置第二列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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