954,153 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

check\uncheck all checkboxes in datalist control

check\uncheck all checkboxes in datalist control in asp.net with vb.

Protected Sub DataList8_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList8.ItemDataBound

        If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then

            Dim chkSelect As New CheckBox
            chkSelect = DirectCast(e.Item.FindControl("chkSelect"), CheckBox)

            chkSelect.Attributes.Add("onclick", "javascript:return Validate(this.name)")
        End If
end sub

getting error in chkSelect.Attributes.Add("onclick", "javascript:return Validate(this.name)")

Object reference not set to an instance of an object.


give me the suggesion where i have to update my code

sireesha.c
Newbie Poster
17 posts since May 2008
Reputation Points: 10
Solved Threads: 0
 

chkselect check box doesnt exists,so u are getting the error.Whats directcast

greeny_1984
Posting Whiz
372 posts since Apr 2007
Reputation Points: 25
Solved Threads: 29
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You