问题描述
|
我有一个下拉列表,其中装有来自SQL数据库的数据。这可能是我在aspx文件中所拥有的。我如何(尽可能)将代码从aspx文件移动到aspx.cs文件,以实现技术背后的代码?
我的意思是至少是SELECT部分。
谢谢。
<asp:DropDownList ID=\"DropDownList1\" ... runat=\"server\"/>
...
<asp:SqlDataSource ID=\"SqlDataSource1\" runat=\"server\"
ConnectionString=\"<%$ ConnectionStrings:Pubs %>\"
SelectCommand=\"SELECT [au_id],[au_lname],[au_fname],[state] FROM [authors] WHERE [state] = @state\">
<SelectParameters>
<asp:ControlParameter Name=\"state\" ControlID=\"DropDownList1\" PropertyName=\"SelectedValue\" />
</SelectParameters>
</asp:SqlDataSource>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)