User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 426,425 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,400 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 937 | Replies: 0
Reply
Join Date: Dec 2006
Posts: 8
Reputation: SANJISH is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
SANJISH SANJISH is offline Offline
Newbie Poster

checkbox checkchanged event not firing in datalist control

  #1  
May 9th, 2008
I have a checkbox inside a datalist control with Autopostback="True". When a user clicks the checkbox the associated event Handler is not firing.

My code is

In HTML :

  1. <asp:DataList ID="myDataList" runat="server" RepeatColumns="1" RepeatDirection="Vertical" >
  2. <ItemTemplate>
  3. <asp:CheckBox ID="chkid" runat="server" autopostback="True" />
  4. <%#"Id " + Container.DataItem("CustomerID")%><br />
  5. <%#"Name " + Container.DataItem("ContactName")%>
  6. <br />
  7. <br />
  8.  
  9. </ItemTemplate>
  10. </asp:DataList>&nbsp;

In Code behind :

Protected Sub myDataList_ItemCreated(ByVal sender As Object, ByVal e As  system.Web.UI.WebControls.DataListItemEventArgs) Handles myDataList.ItemCreated

        Dim alSelectedValues As New ArrayList

        For Each item As DataListItem In myDataList.Items
            'check the item isn't a header or footer
            If e.Item.ItemIndex > -1 Then
                Dim cb As CheckBox = e.Item.FindControl("chkid")
                AddHandler cb.CheckedChanged, AddressOf Me.checkboxclicked

                Dim value As String = cb.Text
                Dim checked As Boolean = cb.Checked
                 If checked Then
                    alSelectedValues.Add(value)
                End If
            End If

        Next


The checkboxclicked event Handler is not firing

Please help

Regards

Sanjish
Last edited by peter_budo : May 10th, 2008 at 3:11 pm. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the ASP Forum

All times are GMT -4. The time now is 2:18 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC