PDA

Click to See Complete Forum and Search --> : Checkbox.checked


adeelahmed
Apr 13th, 2005, 04:43 AM
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
--------------------------------------------------------

adeelahmed
Apr 14th, 2005, 04:35 AM
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

adeelahmed
Apr 14th, 2005, 11:42 PM
This problem was solved

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