数据从数据库里读出来了 关联也实现了
唯一的缺点是每次选择DropDownList 页面就会刷新而且别的表单的字段都值空了,这样填写注册表单很不优化 请高手指教怎么解决这个问题?<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="Province" DataValueField="Province" meta:resourcekey="DropDownList1Resource1" AutoPostBack="True">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource2"
DataTextField="City" DataValueField="City" meta:resourcekey="DropDownList2Resource1">
</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:renluoConnectionString %>"
SelectCommand="SELECT DISTINCT [City], [Province] FROM [Region] WHERE ([Province] = @Province)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="Province" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:renluoConnectionString %>"
SelectCommand="SELECT DISTINCT [Province] FROM [Region] order by Province asc"></asp:SqlDataSource>
唯一的缺点是每次选择DropDownList 页面就会刷新而且别的表单的字段都值空了,这样填写注册表单很不优化 请高手指教怎么解决这个问题?<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="Province" DataValueField="Province" meta:resourcekey="DropDownList1Resource1" AutoPostBack="True">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource2"
DataTextField="City" DataValueField="City" meta:resourcekey="DropDownList2Resource1">
</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:renluoConnectionString %>"
SelectCommand="SELECT DISTINCT [City], [Province] FROM [Region] WHERE ([Province] = @Province)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="Province" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:renluoConnectionString %>"
SelectCommand="SELECT DISTINCT [Province] FROM [Region] order by Province asc"></asp:SqlDataSource>
解决方案 »
- 关键词以空格隔开的查询相关文章的方法
- 查询sql server 2000数据库时超时
- 写一单据:主、明细文件放在一个页面一次提交 还是用TabStrip分页保存 或 分2个页面分步保存方便?
- GridView 表格线颜色的问题
- 请教:微软LCS与腾讯RTX比有什么优势和劣势?
- 各位兄弟姐妹,老少爷们来瞧一瞧看一看拉
- 关于日期计算的问题,没分了,但还是希望得到大家的帮助。
- 如何在showModalDialog弹出的窗体关闭后不刷新页面
- 如何在WEB页面加载ACTIVEX
- 如何把Access中的是/否字段绑定到DataGrid中的复选框
- 请教:工作流内部的某个活动执行完成后,如何控制web页面跳转(response.redirect)?
- 关于数据库程序集问题 无法删除根节点或静态节点
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
数据不丢失,就要使用ajax实现局部刷新。用updatepanel
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate> </ContentTemplate>
</asp:UpdatePanel>
UpdatePanel 是可以解决楼主问题的