How to uncheck the checkbox??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shravanti88
    New Member
    • Mar 2010
    • 7

    #1

    How to uncheck the checkbox??

    Hi..

    Code:
     Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click
            Dim chkBtndel As CheckBox
            Dim strID As String = ""
            Dim count As Integer = 0
            Dim objdel As ProjectsProcessData = New ProjectsProcessData()
            Dim arrOItems As ArrayList = New ArrayList()
            Dim objdele As TR_Projects = New TR_Projects()
            Try
                For Each dataitem As DataListItem In DLProjects.Items
                    If dataitem.ItemType = ListItemType.Item Or dataitem.ItemType = ListItemType.AlternatingItem Then
                        ' -- Find all the item
                        ' Dim objNewEmp As New FAMS.EntityClass.SVCEmployee
    
                        chkBtndel = dataitem.FindControl("chkRemovePart")
    
                        Dim lblProId As LinkButton = dataitem.FindControl("HyperID")
    
                        If chkBtndel.Checked = True Then
                            strID += lblProId.ToolTip + ","
                        End If
                    End If
    
                Next
    
                strID = strID.Substring(0, strID.Length - 1)
                count = objdele.DeleteProjectsRecords(strID)
    
                If count > 0 Then
                    ShowMessage("Records Deleted Successfully")
                    BindDataList()
                Else
                    ShowMessage("Unable To Request Process")
    
                End If
    
            Catch ex As Exception
    
            End Try
        End Sub
    In my datalist, when i try to delete a particular parent record ,it will display an alert message ("unable to request process").the checkbox is still checked after loading the page.Can you pls temme how to uncheck the checkbox??

    Regards,
    Shravs
  • ThatThatGuy
    Recognized Expert Contributor
    • Jul 2009
    • 453

    #2
    Originally posted by shravanti88
    Hi..

    Code:
     Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click
            Dim chkBtndel As CheckBox
            Dim strID As String = ""
            Dim count As Integer = 0
            Dim objdel As ProjectsProcessData = New ProjectsProcessData()
            Dim arrOItems As ArrayList = New ArrayList()
            Dim objdele As TR_Projects = New TR_Projects()
            Try
                For Each dataitem As DataListItem In DLProjects.Items
                    If dataitem.ItemType = ListItemType.Item Or dataitem.ItemType = ListItemType.AlternatingItem Then
                        ' -- Find all the item
                        ' Dim objNewEmp As New FAMS.EntityClass.SVCEmployee
    
                        chkBtndel = dataitem.FindControl("chkRemovePart")
    
                        Dim lblProId As LinkButton = dataitem.FindControl("HyperID")
    
                        If chkBtndel.Checked = True Then
                            strID += lblProId.ToolTip + ","
                        End If
                    End If
    
                Next
    
                strID = strID.Substring(0, strID.Length - 1)
                count = objdele.DeleteProjectsRecords(strID)
    
                If count > 0 Then
                    ShowMessage("Records Deleted Successfully")
                    BindDataList()
                Else
                    ShowMessage("Unable To Request Process")
    
                End If
    
            Catch ex As Exception
    
            End Try
        End Sub
    In my datalist, when i try to delete a particular parent record ,it will display an alert message ("unable to request process").the checkbox is still checked after loading the page.Can you pls temme how to uncheck the checkbox??

    Regards,
    Shravs
    if you want the checkbox to be unchecked... on page load....
    you can manually write the code for this or you can change the CheckBox's ViewState property to False

    Comment

    • mfaisalwarraich
      New Member
      • Oct 2007
      • 194

      #3
      this may help you:

      (How can I check the 'Checked' property of a dynamically-created checkbox during the Page_Load subroutine?)

      http://stackoverflow.com/questions/1...-page-postback

      Comment

      Working...