2010-03-05 148 views

回答

1

在標記添加複選框

<asp:CheckBox ID="ChkSelect" runat="server" /> 

後面的代碼如下:

Dim ChkSelect As CheckBox = Nothing 
Dim ListItem As ListViewDataItem = Nothing 
Dim ItemList As List(Of Person) = New List(Of Person) 
Dim Item As Person= Nothing 

    For Each ListItem In MyDataList.Items 
     ChkSelect = ListItem.FindControl("ChkSelect") 
     If ChkSelect.Checked Then 

      Dim UIN As Integer = _ 
       MyDataList.DataKeys(ListItem.DisplayIndex).Value.ToString() 
      Item = Persons.GetData(UIN) 
      Item.Deleted = True 
      ItemList.Add(Item) 

     End If 
    Next 
    Data = Persons.UpdateBulk(ItemList) 
    If Data = True Then 
     BindMyData() 
    End If 
0

我用GridView的模板,如果我想要做的是,在GridView的...嘗試,如果有看,如果那裏有ListView控件模板。

相關問題