Results 1 to 2 of 2

Thread: uncheck checkbox when click on link label

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2009
    Posts
    22

    uncheck checkbox when click on link label

    hi all,

    my question is fairly straightforward. i have a gridview that has several columns in it, including a linklabel column and a checkbox column. what i need is everytime the user clicks on the link label, the checkbox on that very row gets unchecked, and only after the user gets redirected to another page. so that when he clicks the back button (in his browser), the checkbox on that row would remain unchecked.

    here is a little bit of code that i trying to do, but it isnt working right now, probably because the postback isnt dont, or the viewstate isnt changed, or somthing similar.:

    Code:
        Protected Sub dgEvents_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles dgEvents.RowCommand
            If e.CommandName.ToLower() = "edt" Then
                Dim lb As LinkButton = CType(e.CommandSource, LinkButton)
                Dim gvRow As GridViewRow = CType(lb.BindingContainer, GridViewRow) 'Getting current row to get index
                CType(dgEvents.Rows(gvRow.RowIndex).FindControl("chkbox"), System.Web.UI.WebControls.CheckBox).Checked = False
                Dim strKey As String = dgEvents.DataKeys(gvRow.RowIndex)(0).ToString()
                Dim _myCrypt As New Crypt
                Response.Redirect("LocalEvent.aspx?id=" & HttpUtility.UrlEncode(_myCrypt.Encrypt(strKey))) 'redirecting
            End If
        End Sub
    as always... thanks in advance

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Apr 2009
    Posts
    22

    Re: uncheck checkbox when click on link label

    ok, nvm... i managed to get around this problem by changing my update command so that i pretty much don't care about the checkbox state.

    please, consider this thread as closed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width