日期:2014-05-19  浏览次数:20400 次

将C#代码转成v.net的代码
代码如下:      
  int   i;
                if   (((CheckBox)sender).Checked)
                {
                        for   (i   =   0;   i   <   GridView1.Rows.Count;   i++)
                        {
                                ((CheckBox)GridView1.Rows[i].FindControl( "CheckBox1 ")).Checked   =   true;
                        }
                }
                else
                {
                        for   (i   =   0;   i   <   GridView1.Rows.Count;   i++)
                        {
                                ((CheckBox)GridView1.Rows[i].FindControl( "CheckBox1 ")).Checked   =false;
                        }
                }
我不知道应当如何将(((CheckBox)sender).Checked)转换,我现在的代码也可以,但是比较麻烦,如下:
          Dim   i   As   Integer
                '
                Dim   test   As   CheckBox
                test   =   sender
                If   test.Checked   Then
                        For   i   =   0   To   GridView1.Rows.Count   -   1
                                Dim   test1   As   CheckBox
                                test1   =   GridView1.Rows(i).FindControl( "CheckBox2 ")
                                test1.Checked   =   True
                        Next   i
                Else
                        For   i   =   0   To   GridView1.Rows.Count   -   1
                                Dim   test1   As   CheckBox
                                test1   =   GridView1.Rows(i).FindControl( "CheckBox2 ")