各位高手:我用 c# 写的 web 页面  想在 table 表格里面 嵌入 checkbox 控件可以吗 这样可以起到选择某一行的作用

解决方案 »

  1.   

    可以啊GridView的模板列里就可以放
      

  2.   

    我用的  vs2003  怎么没有看到 GridView
      

  3.   

    private   void   Page_Load(object   sender,   System.EventArgs   e) 

    //   在此处放置用户代码以初始化页面 
    //定义一个Html的行和列 
    HtmlTableRow   myr; 
    HtmlTableCell   myc; CheckBox   CHB; 
    for(int   r=0;r <4;r++) 

    myr   =   new   HtmlTableRow(); for(int   c=0;c <2;c++) 

    myc   =new   HtmlTableCell(); //动态实例一个CheckBox控件 
    CHB=new   CheckBox(); 
    CHB.ID= "CB "+r.ToString(); 
    if(c==0) 

    myc.Controls.Add(CHB); 

    else 

    myc.InnerHtml= "ID= "+r.ToString(); 

                                    
    //使用表自身的行控件 
    myr.Cells.Add(myc); 

    Table1.Rows.Add(myr); 


    private   void   Button1_Click(object   sender,   System.EventArgs   e) 

    for(int   i=0;i <Table1.Rows.Count;i++) 

    Table1.Rows[i].Cells[1].InnerHtml=((CheckBox)Table1.Rows[i].Cells[0].FindControl( "CB "+(i).ToString())).Checked.ToString(); 


      

  4.   

    有高手能解决 vs2003  table 表格里面 嵌入 checkbox 控件可以吗 ? 我写的是web 页面不用 DATAGRID 控件