Checkbox column puzzler.

J

jake

When I check checkboxes in my checkbox column(template column), the
checked property never becomes TRUE.

Yet if I set the checkbox checked property of the checkbox control to
TRUE, then this code:

Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles LinkButton1.Click
Dim myDataGridItem As DataGridItem
Dim chkSelected As System.Web.UI.WebControls.CheckBox
Dim ChartCurrGP(10) As String
Dim ChartCurrSalesDollars(10) As String
Dim ChartPriorGP(10) As String
Dim ChartPriorSalesDollars(10) As String
Dim ChartDesc(10) As String
Dim dr As String
Dim i As Integer = 0
For Each myDataGridItem In Datagrid1.Items
chkSelected = myDataGridItem.FindControl("chkSelection1")
Dim test As Boolean = chkSelected.Checked

If chkSelected.Checked Then
If i = 10 Then
Exit For
End If

recognizes that the checked property is TRUE.

What would cause this? The check marks display in the checkboxes of
the grid.

jake
 
J

jake

jake said:
When I check checkboxes in my checkbox column(template column), the
checked property never becomes TRUE.

Well I solved my own problem for the 2nd time today...Hope it benefits
some other desperate soul.

The cause of my problem was that a datagrid.databind() was occurring
between the click of my linkbutton and the running of its handler.

The solution in my case was simply:
If Not Page.IsPostBack Then
Datagrid1.DataBind()
End If

jake
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top