|
Rank: Advanced Member Groups: Member
Joined: 3/9/2010 Posts: 119
|
I am trying to create 2 columns in the listbox with headers but I keep getting a binding error. The dataset has a single table with 3 columns(Id, Task, Hr). The 1st code segment is the html and the second is the vb.net. What am I doing wrong?
Code: HTML/ASPX
<eo:ListBox ID="lsbTask" runat="server" ControlSkinID="None" Height="150px"
Width="600px">
<FooterStyle CssText="background-image:url('00020013'); background-position: left top; background-repeat: repeat; height:16px;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;width:196px;" />
<DisabledItemStyle CssText="background-color: white; color: #c0c0c0; padding:2px;" />
<ItemStyle CssText="background-color: white;padding:2px;" />
<ListBoxStyle CssText="font-size: 9pt; font-family: Verdana; color: black; cursor: hand; border-right: #999999 1px solid; border-top: #999999 1px solid; border-left: #999999 1px solid; border-bottom: #999999 1px solid;background-color:white;" />
<FooterTemplate>
</FooterTemplate>
<HeaderStyle CssText="background-image:url('00020013'); background-position: left top; background-repeat: repeat; height:16px;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;" />
<HeaderTemplate>
<table>
<tr>
<td style="font-family: Cambria; font-size: 9px; font-weight: bold; color: floralwhite; background-color: darkolivegreen; border-style: solid; border-width: 1px; width: 500px; text-align: center">Task</td>
<td style="font-family: Cambria; font-size: 9px; font-weight: bold; color: floralwhite; background-color: darkolivegreen; border-style: solid; border-width: 1px; width: 100px; text-align: center">Remaining Hours</td>
</tr>
</table>
</HeaderTemplate>
<SelectedItemStyle CssText="background-color: #08246b; color:white; padding:2px;" />
<ItemHoverStyle CssText="background-color: #f1f1f1;padding:2px;" />
<ItemTemplate>
<table>
<tr>
<td style="font-family: Cambria; font-size: 9px; width: 500px; text-align: left;">
<%#Eval("Task")%>
</td>
<td style="font-family: Cambria; font-size: 9px; width: 100px; text-align: left;">
<%#Eval("Hr")%>
</td>
</tr>
</table>
</ItemTemplate>
</eo:ListBox>
Code: Visual Basic.NET
With lsbTasks
.DataSource = EmpData.GetDataSet
.DataValueField = "Id"
.DataBind()
End With
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We won't troubleshoot data binding errors for you since data binding is a feature directly supported by ASP.NET. However if you believe the problem is related to us, please try to create a complete test page that demonstartes the problem (you will need to replace your data source with hard coded data, for example, a DataTable created from code) and we will be happy to take a look.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 3/9/2010 Posts: 119
|
The data binding issue was resolved by using a datatable instead of the dataset and the listbox now displays 2 columns but when I select an item the combobox displays unidentified. Is there a way to indicate what column should be displayed in the combobox?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I believe you need to set the ListBox's DataTextField property.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 3/9/2010 Posts: 119
|
That did it, thanks.
|
|