ListView 嵌套ListView 时动态绑定事件问题。急急急
本人最近在做个项目需要动态绑定事件到控件。可是这样的写法无法响应。求各位大神指正。急急急
Protected Sub lv_ImagesContain_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) Handles lv_ImagesContain.ItemDataBound
Dim lv_Images As ListView = e.Item.FindControl("lv_Images")
Dim dtHotelImage As DataTable = Cache("dtHotelImage")
Dim drImages() As DataRow = dtHotelImage.Select(String.Format("Type='{0}'", DataBinder.Eval(e.Item.DataItem, "Type")))
Dim dtImages As DataTable = drImages.CopyToDataTable
If dtImages.Rows.Count > 0 Then
lv_Images.DataSource = dtImages
lv_Images.DataBind()
'AddHandler lv_Images.ItemCommand, AddressOf lv_Images_ItemCommand
'AddHandler lv_Images2.ItemCommand, New EventHandler(Of ListViewCommandEventArgs)(AddressOf lv_Images_ItemCommand)
End If
AddHandler lv_Images.ItemCommand, New EventHandler(Of ListViewCommandEventArgs)(AddressOf lv_Images_ItemCommand)
End Sub
Public Sub lv_Images_ItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewCommandEventArgs)
If e.CommandName = "ImageDel" Then
Dim lb_ImageUrl As Label = e.Item.FindControl("lb_ImageUrl")
If FneDLL.TableDLL.HotelImageDLL.DeleteHotelImage(CType(e.CommandArgument, Integer), lb_ImageUrl.Text) Then
lb_ImageMeg.Text = "删除文件成功"
BindHotelImageLV(lb_HotelCode.Text)
Else
lb_ImageMeg.Text = "文件删除失败,请重试"
End If
End If
End Sub listview
[解决办法]
Handles lv_ImagesContain.ItemDataBound
下边的那个listview绑定时间了么
[解决办法]