CheckBox in Datalist ItemTemplate

S

Sung

Hi,
I have a datalist contains ItemTemplate with a few controls. One of the
controls is a CheckBox control which serves as user input rather than bound
display control. When the page is submitted, I want to know the state of
every CheckBox control in the datalist. Also, I have a hidden field which is
a primary key of my SQL database table and I want to get that information as
well. My datalist is bound from database except the checkbox as following:

<asp:datalist id="CouponsList" runat="server" RepeatColumns="1" Width="600">
<ItemTemplate>
<table border="0" width="600">
<tr>
<td width="40" valign="middle">
<asp:CheckBox id="ckbSelect" runat="server"></asp:CheckBox>
</td>
<td width="2">
<asp:label class="Normal" id="lblStoreID" runat="server"
Visible="false">
<%# DataBinder.Eval(Container.DataItem, "SomeSQLTableID") %>
</asp:label>
</td>
//... other bound controls
</tr>
</table>
</ItemTemplate>
</asp:datalist>

In the behind code I check the check state and if it's selected, I get the
ID. How can I do this?

Any help would be appreciated.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top