Markup page <!– ‘define control –> <asp:DropDownList ID=”MySelectionDDL” runat=”server” AutoPostBack=”True” AppendDataBoundItems=”true” DataSourceID=”MySelectionDS” DataTextField=”Text” DataValueField=”Value” OnDataBound=”MySelectionDDL_DataBound”> <!– ‘define datasource –> <asp:SqlDataSource ID=”MySelectionDS” runat=”server” ConnectionString=”< %$ ConnectionStrings:my_sql_connection %>” SelectCommand=”SELECT [Text], [Value] FROM [MyTable] ORDER BY [Text]”> </asp:SqlDataSource> Code behind Protected Sub MySelectionDDLDataBound(ByVal sender As Object, ByVal e As EventArgs) ‘add item at the beginning of the list […]
Archive for December 19, 2012