后台绑定:
DataTable dt = RateStorage.GetDataTable(2);
foreach (System.Data.DataRow dr in dt.Rows)
{
ListItem li = new ListItem();
li.Value = dr["ChargeAmount"].ToString();
li.Text = (dr["Days"].ToString().TrimEnd()).PadRight(10, '\u00A0') + dr["ChargeAmount"].ToString();
if (dr["Days"].ToString() == "1")
{
li.Selected = true;
}
lbRate.Items.Add(li);
}
前台:
<asp:ListBox runat="server" ID="lbRate" Width="200px" Height="350px" SelectionMode="Single"></asp:ListBox>
在ie、firefox下测试通过