Results 1 to 3 of 3

Thread: Checkbox.checked

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Pakistan
    Posts
    80

    Checkbox.checked

    Hi

    I've added template column in my datagrid and have added checkbox in it.
    while getting checkvalue from the checkbox, it is always showing checkbox.check=false , though it is checked


    ------------------------------------------------------
    Dim dgi As DataGridItem
    Dim StrpccID As String
    For Each dgi In dgCTrack.Items
    Dim ChkSelected As CheckBox
    ChkSelected = CType(dgi.FindControl("cbpcc"), CheckBox)
    If ChkSelected.Checked = True Then
    StrpccID += CType(dgi.Cells(1).FindControl("lblPCCID"), Label).Text & ","
    End If
    Next
    Session("PCCList") = StrpccID
    --------------------------------------------------------



    Adeel Ahmed

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Pakistan
    Posts
    80

    Red face How to use a checkbox in a datagrid template column

    in my code the chkpcc.checked=true is showing false, though it is checked.

    Private Sub btngen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btngen.Click
    Dim dgi As DataGridItem
    Dim StrpccID As String
    For Each dgi In dgCTrack.Items
    Dim chkPCC As CheckBox
    chkPCC = CType(dgi.FindControl("cbtPCC"), CheckBox)
    If chkPCC.Checked = True Then
    StrpccID += CType(dgi.Cells(1).FindControl("lblpccid"), Label).Text & ","
    End If
    Next
    StrpccID = StrpccID.TrimEnd(",")
    Session("PCCList") = StrpccID
    Response.Redirect("newsaragencydetail.aspx")
    End Sub



    Adeel Ahmed

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Pakistan
    Posts
    80

    Re: Checkbox.checked [SOLVED]

    This problem was solved

    on page load event ...
    If Not IsPostBack Then
    datagrid.bind()
    end if



    Adeel Ahmed

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