Does anyone know how can I default selected value in asp:DropDownList?
Following is my code:
<tr>
<th align="right"><strong>Test: </strong></th>
<td>
<asp:DropDownList ID="Test" runat="server" DataSourceID="dsTest"
DataValueField="TestID" DataTextField="TestName" AppendDataBoundItems="true">
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="dsTest" runat="server" ConnectionString="<%$ ConnectionStrings:Test %>"
SelectCommand="test_select" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
</td>
</tr>
How can I able to selected the display list which is the TestID is 1?
You have couple of options first one is below if you want to do this by default.
Or you can do this in code