I have a listbox on a user control that serves as an edit control for a radgrid that is on another user control.
Everything executes without error but when the listbox displays it has nothing selected.
Here is the aspx and code behind.
private void UsersControlEditSCS_DataBinding(object sender, System.EventArgs e)
{
listSCS.DataBind();
listSCS.Items[i].Selected = true;
listSCS.Items[0].Selected = true;
listSCS.Items[1].Selected = true;
listSCS.Items[2].Selected = true;
}
}
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UsersControlEditSCS.ascx.cs" Inherits="BalancedFlow.WebSite3._5.Controls.UsersControlEditSCS" %>
<table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="1" rules="none"
style="border-collapse: collapse">
<tr>
<td colspan="2">
<b>Link to SCS</b></td>
</tr>
<tr>
<td colspan="2">
(Select one, or more with CTRL key)</td>
</tr>
<tr>
<td>
<table id="Table3" cellspacing="1" cellpadding="1" width="100%" border="0">
</table>
</td>
<td>
<table id="Table1" cellspacing="1" cellpadding="1" width="300" border="0">
<tr>
<td>
</td>
</tr>
<tr>
<td>
<asp:ListBox ID="listSCS" runat="server" SelectionMode="Multiple" DataTextField="SCS_Name"
DataValueField="SCS_ID" Width="325px"></asp:ListBox>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>