J
John
If you set DropDownList.SelectedValue to an item not in the list, shouldn't
an exception be thrown? ie:
<asp
ropDownList ID="DropDownList1" runat="server">
<asp:ListItem Text="1" Value="1"></asp:ListItem>
<asp:ListItem Text="2" Value="2"></asp:ListItem>
<asp:ListItem Text="3" Value="3"></asp:ListItem>
</asp
ropDownList>
Then in the codebehind:
DropDownList1.SelectedValue = "999";
No exception is thrown, but the docs say:
"The SelectedValue property can also be used to select an item in the list
control by setting it with the value of the item. If no items in the list
control contain the specified value, a System.ArgumentOutOfRangeException is
thrown."
XP Pro sp2. ASP.NET 2.0 (VS2005 Team Edition for Soft Devs). C# 2.0. All the
latest updates.
Thanks,
John
an exception be thrown? ie:
<asp

<asp:ListItem Text="1" Value="1"></asp:ListItem>
<asp:ListItem Text="2" Value="2"></asp:ListItem>
<asp:ListItem Text="3" Value="3"></asp:ListItem>
</asp

Then in the codebehind:
DropDownList1.SelectedValue = "999";
No exception is thrown, but the docs say:
"The SelectedValue property can also be used to select an item in the list
control by setting it with the value of the item. If no items in the list
control contain the specified value, a System.ArgumentOutOfRangeException is
thrown."
XP Pro sp2. ASP.NET 2.0 (VS2005 Team Edition for Soft Devs). C# 2.0. All the
latest updates.
Thanks,
John