J
Jim Heavey
Hello, I am starting to learn how to use the Datagrid and I have a couple of
questions.
My datagrid as a checkbox in it. It looks like the following in the
datagrid...
<asp:TemplateColumn HeaderText="Check In">
<ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle>
<ItemTemplate>
<asp:CheckBox id="chkReturn" runat="server"
OnCheckedChanged="CheckItIn"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
I had expected that when I click the checkbox, that the "OnCheckedChanged"
event specified would fire. It does not. I added the "AutoPostBack="True"
and I can see that it is making a trip back to the server, but the event
specified is not fired. How do I get the event to fire?
I wrote a little routine to interogate the values in the datagrid when a
button is clicked. The problem is that all the values for the checkbox are
always false. I must be doing something wrong in looking at these values, but
I am not sure what it is. Here a portion of the routine:
Dim item As DataGridItem
Dim itemCnt As Integer = dgCheckIn.Items.Count
For Each item In dgCheckIn.Items
Dim cnt3 As Integer = 0
Dim chkBox As CheckBox
For cnt3 = 0 To item.Cells(3).Controls.Count - 1
If TypeOf item.Cells(3).Controls(cnt3) Is CheckBox Then
Console.WriteLine("Found a Checkbox Control at instance of {0}",
cnt3)
chkBox = CType(item.Cells(3).Controls(cnt3), CheckBox)
End If
Next
Dim bol As Boolean = chkBox.Checked
Next
Any Ideas what I am doing wrong?
Thanks in advance for your assistance!!!!!!!!!
questions.
My datagrid as a checkbox in it. It looks like the following in the
datagrid...
<asp:TemplateColumn HeaderText="Check In">
<ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle>
<ItemTemplate>
<asp:CheckBox id="chkReturn" runat="server"
OnCheckedChanged="CheckItIn"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
I had expected that when I click the checkbox, that the "OnCheckedChanged"
event specified would fire. It does not. I added the "AutoPostBack="True"
and I can see that it is making a trip back to the server, but the event
specified is not fired. How do I get the event to fire?
I wrote a little routine to interogate the values in the datagrid when a
button is clicked. The problem is that all the values for the checkbox are
always false. I must be doing something wrong in looking at these values, but
I am not sure what it is. Here a portion of the routine:
Dim item As DataGridItem
Dim itemCnt As Integer = dgCheckIn.Items.Count
For Each item In dgCheckIn.Items
Dim cnt3 As Integer = 0
Dim chkBox As CheckBox
For cnt3 = 0 To item.Cells(3).Controls.Count - 1
If TypeOf item.Cells(3).Controls(cnt3) Is CheckBox Then
Console.WriteLine("Found a Checkbox Control at instance of {0}",
cnt3)
chkBox = CType(item.Cells(3).Controls(cnt3), CheckBox)
End If
Next
Dim bol As Boolean = chkBox.Checked
Next
Any Ideas what I am doing wrong?
Thanks in advance for your assistance!!!!!!!!!