943,640 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 4485
  • ASP.NET RSS
Jul 18th, 2008
0

check\uncheck all checkboxes in datalist control

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

ASP.NET Syntax (Toggle Plain Text)
  1. Protected Sub DataList8_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList8.ItemDataBound
  2.  
  3. If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
  4.  
  5. Dim chkSelect As New CheckBox
  6. chkSelect = DirectCast(e.Item.FindControl("chkSelect"), CheckBox)
  7.  
  8. chkSelect.Attributes.Add("onclick", "javascript:return Validate(this.name)")
  9. End If
  10. 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
Last edited by Tekmaven; Jul 18th, 2008 at 6:16 pm. Reason: Code tags
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sireesha.c is offline Offline
17 posts
since May 2008
Jul 19th, 2008
0

Re: check\uncheck all checkboxes in datalist control

chkselect check box doesnt exists,so u are getting the error.Whats directcast
Reputation Points: 25
Solved Threads: 29
Posting Whiz
greeny_1984 is offline Offline
372 posts
since Apr 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Asp.Net
Next Thread in ASP.NET Forum Timeline: Help Check browser





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC