[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Geert Maesele

6/14/2002 7:57:00 AM

Hi

How would you implement a multi-selection list?

I tried using a checkbox list, but that doesn't render me the HTML I thought
it would do..

<mobile:form id="SelectMakeForm" runat="server">
<mobile:Label id="lblSelect" runat="server"
Alignment="Center">Select</mobile:Label>
<mobile:Panel id="mobilePanel" Runat="server" BreakAfter="False">
<asp:CheckBoxList id="CheckBoxList1"
runat="server"></asp:CheckBoxList>
</mobile:Panel>
<mobile:Command id="btnSelect" runat="server">Go</mobile:Command>
</mobile:form>

In the Page_OnLoad method (code-behind page) I add items to the
checkBoxList, with:
For Each dataTableRowObj In dataTableObj.Rows()
Dim checkBoxItem As New WebControls.ListItem()
checkBoxItem.Text = dataTableRowObj.Item("description").ToString()
checkBoxItem.Value = dataTableRowObj.Item("ID").ToString()
CheckBoxList1.Items.Add(checkBoxItem)
Next

This is the HTML I get:
<div align="Center">Select makes
<table id="CheckBoxMakeList" border="0">
<tr>
<td>
<input id="CheckBoxMakeList_0" type="checkbox"
name="CheckBoxMakeList:0" />
<label for="CheckBoxMakeList_0"></div>Description1
</label>
</td>
</tr>
<tr>
<td>
<input id="CheckBoxMakeList_1" type="checkbox"
name="CheckBoxMakeList:1" />
<label for="CheckBoxMakeList_1">Description2
</label>
</td>
</tr>
....

So no where I see the values I assigned to the checkbox items. And because
of the </div> tag in the first element the description is displayed beneeth
the first checkbox. For all other checkboxes this is no problem.

Geert