如何在datagrid控件里面添加check控件
谢谢

解决方案 »

  1.   

    给你一个 MSFlexGrid 嵌入 Check 控件的例子:
    Dim lcol, lrow As LongPrivate Sub Form_Load()
    With MSFlexGrid1
    lcol = 1
    .Col = 1
    lrow = 1
    .Row = 1
    MSFlexGrid1_RowColChange
    End With
    End SubPrivate Sub MSFlexGrid1_RowColChange()
    With MSFlexGrid1
    lcol = .Col
    lrow = .Row
    Check1.Visible = True
    Check1.Height = .CellHeight
    Check1.Width = .CellWidth
    Check1.Left = .CellLeft + .Left
    Check1.Top = .CellTop + .Top
    End With
    End SubPrivate Sub MSFlexGrid1_Scroll()
    With MSFlexGrid1
    If .RowIsVisible(lrow) And .ColIsVisible(lcol) Then
    Check1.Visible = True
    Check1.Height = .CellHeight
    Check1.Width = .CellWidth
    Check1.Left = .CellLeft + .Left
    Check1.Top = .CellTop + .Top
    Else
    Check1.Visible = False
    End If
    End With
    End Sub
      

  2.   

    <asp:dataGrid....>
    ...
    <asp:TemplateColumn HeaderText="选择">
    <ItemTemplate>
    <asp:CheckBox ID="chk" Runat="server" text=选择></asp:CheckBox >
    </ItemTemplate>
    </asp:TemplateColumn>
    </datagrid>
      

  3.   

    一楼的老兄谢谢你的例子我发现vsdatagrid可以用这个例子
    但是对于datagrid,我查了查这方面的资料好像不能啊!!
    你有没有试过?!