M
Mick Walker
I am using a repeater to display contacts to the user.
Here is my repeater:
<asp:Repeater ID="RepContacts" runat="server">
<HeaderTemplate><table cellpadding="5" cellspacing="2">
<tr>
<td><b>Contact Name</b></td>
<td></td>
<td><b>Invite</b></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr class="RowStyle">
<td align="left" valign="top">
<asp:label width="300px" ID="lblName"
Text='<%# left(Eval("Name"), 280) %>' runat="server"></asp:label>
<asp:TextBox ID="txtID" runat="server"
Visible="false" Text='<%#Eval("ID") %>' />
<asp:TextBox ID="txtEmail"
runat="server" Visible="false" Text='<%#Eval("Email") %>' /></td>
<td> </td>
<td align="left" valign="top">
<asp:CheckBox ID="chkInvite"
runat="server" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate></table></FooterTemplate>
</asp:Repeater>
I set the data source property via my code behind and bind it to the
repeater, and all works fine.
When i come to process the user options however, I have an issue. Here
is my code:
'loop through the repeater
For Each Item As RepeaterItem In RepContacts.Items
Dim chkInvite As New CheckBox
ChkInvite = CType(Item.FindControl("chkInvite"), CheckBox)
Dim txtEmail As New TextBox
txtEmail = CType(Item.FindControl("txtEmail"), TextBox)
Dim txtID As New TextBox
txtID = CType(Item.FindControl("txtID"), TextBox)
If chkInvite.Checked = True Then
'Do Stuff ' Never gets called for some reason???
End If
Next
When I debug, not matter what the value of the checkbox on the repeater,
the code picks it up as Checked = False. It gets the values of the text
boxes fine, but I am really at a loss as to why this is happening.
Anyone care to lend a hand?
Regards
Mick
Here is my repeater:
<asp:Repeater ID="RepContacts" runat="server">
<HeaderTemplate><table cellpadding="5" cellspacing="2">
<tr>
<td><b>Contact Name</b></td>
<td></td>
<td><b>Invite</b></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr class="RowStyle">
<td align="left" valign="top">
<asp:label width="300px" ID="lblName"
Text='<%# left(Eval("Name"), 280) %>' runat="server"></asp:label>
<asp:TextBox ID="txtID" runat="server"
Visible="false" Text='<%#Eval("ID") %>' />
<asp:TextBox ID="txtEmail"
runat="server" Visible="false" Text='<%#Eval("Email") %>' /></td>
<td> </td>
<td align="left" valign="top">
<asp:CheckBox ID="chkInvite"
runat="server" />
</td>
</tr>
</ItemTemplate>
<FooterTemplate></table></FooterTemplate>
</asp:Repeater>
I set the data source property via my code behind and bind it to the
repeater, and all works fine.
When i come to process the user options however, I have an issue. Here
is my code:
'loop through the repeater
For Each Item As RepeaterItem In RepContacts.Items
Dim chkInvite As New CheckBox
ChkInvite = CType(Item.FindControl("chkInvite"), CheckBox)
Dim txtEmail As New TextBox
txtEmail = CType(Item.FindControl("txtEmail"), TextBox)
Dim txtID As New TextBox
txtID = CType(Item.FindControl("txtID"), TextBox)
If chkInvite.Checked = True Then
'Do Stuff ' Never gets called for some reason???
End If
Next
When I debug, not matter what the value of the checkbox on the repeater,
the code picks it up as Checked = False. It gets the values of the text
boxes fine, but I am really at a loss as to why this is happening.
Anyone care to lend a hand?
Regards
Mick