Nested Datalist Controls

D

Darrin

Greetings, I am trying to get the checkbox value from a nested datalist once
I press a button on my form (not within any of the datalist grids). I am
using asp.net 1.1/vb.net

The project I am working on provides users to register for a specific event
and also view all the sessions going on for that event. See example below.


Event: Microsoft Office Training
Location: My City
Date: Dec 21st

Available Sessions:
Wednesday Dec 21st, 9:00AM
*Word 101 (checkbox)
*Excel 200 (checkbox)
*Access (checkbox)

Wednesday Dec 21st 2:00PM
*Access 200 (checkbox)
*Powerpoint (checkbox)

The first datalist (dlSessionDatesTimes) I created goes out to my SQL table
to group the sessions by date and time for the particular event. As the
dlSessionDatesTimes datalist is generated, I go out to my SQL table and
gather all the realted sessions for that particular event, date and time.
These are displayed in the second datalist (dlSessions). Next to each
session I have a check box so the user can go through and select the session
they wish to sign up for.

The question:
After I click the submit button on my form I want to caputure the values
from the check box. How do I access the checkbox that is nested inside the
other datalist (dlSessions)? Or is there another way?

<asp:datalist id="dlSessionDatesTimes" runat="server"
CellSpacing="15" CellPadding="5" Width="100%"
RepeatColumns="1">
<ItemTemplate>
<TABLE class="Content" id="Table3" cellSpacing="1"
cellPadding="5" width="100%" border="0">
<TR>
<TD
class="Normal"><B><%#FormatDateTime(DataBinder.Eval(Container.DataItem,
"WS_DATE"),1) & "-" & Format(DataBinder.Eval(Container.DataItem,
"WS_StartTime"),"Short Time")%></B></TD>
</TR>
<TR>
<TD></TD>
</TR>
<TR>
<TD></TD>
</TR>
</TABLE>
<asp:DataList id=dlSessions runat="server" CssClass="normal"
DataSource='<%# ListSessions(DataBinder.Eval(Container.DataItem,
"WS_DATE"),DataBinder.Eval(Container.DataItem, "WS_StartTime")) %>'
RepeatLayout="Flow">
<ItemTemplate>
<table class="Normal">
<tr>
<td>
Description:</td>
<td><%# Container.DataItem("WS_Description")%></td>
</tr>
<tr>
<td>Presenter:</td>
<td><%# Container.DataItem("WS_Presenter")%></td>
</tr>
<tr>
<td>Target Audience:</td>
<td><%# Container.DataItem("WS_TargetAudience")%></td>
</tr>
<tr>
<td>Location Area:</td>
<td><%# Container.DataItem("WS_LocationArea")%></td>
</tr>
<tr>
<td>CEUS Offered:</td>
<td><%# Container.DataItem("WS_CEUSOFfered")%></td>
</tr>
<tr>
<td>
<asp:checkbox id="chkCEUs" runat="server" Text="CEU's
Offered">
</asp:checkbox></td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</ItemTemplate>
</asp:datalist></TD>
</TR>
<TR>
<TD>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button></TD>
</TR>
<TR>
<TD></TD>
</TR>
</TABLE>
 
E

Elton Wang

Hi Darrin,



Following code shows how to loop thru to get

checkbox in the inner datalist:



Dim innerList As DataList
Dim ckBox As CheckBox
For Each item As DataListItem In dlSessionDatesTimes.Items

innerList = CType(item.FindControl("dlSessions"), DataList)
For Each innerItem As DataListItem In innerList.Items
ckBox = CType(innerList.FindControl("chkCEUs"), CheckBox)
' process

Next
Next



HTH
 
D

Darrin

Thanks!!!

Elton Wang said:
Hi Darrin,



Following code shows how to loop thru to get

checkbox in the inner datalist:



Dim innerList As DataList
Dim ckBox As CheckBox
For Each item As DataListItem In dlSessionDatesTimes.Items

innerList = CType(item.FindControl("dlSessions"), DataList)
For Each innerItem As DataListItem In innerList.Items
ckBox = CType(innerList.FindControl("chkCEUs"), CheckBox)
' process

Next
Next



HTH
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top