在主页上更改dropdownlist时,dropdownlist为双精度值

编程入门 行业动态 更新时间:2024-10-11 23:22:31
本文介绍了在主页上更改dropdownlist时,dropdownlist为双精度值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

某些背景:我在母版页上有一个下拉列表,用户可以用来选择公司的其他区域. 在gridview页面上,我基于网站上的一些代码设置了一个过滤器: demo.evonet. au/GridviewwithFiltering.aspx [ ^ ] 我遇到的问题是,当用户更改母版页上的区域时,下拉列表将填充该区域的新值,并且还保留先前区域的值. 示例:区域A:AA,AB,AC下拉列表将仅显示那些项目.当用户选择区域B:BB,BC,BD时,下拉列表将显示BB,BC,BD,AA,AB,AC. 如何防止这种情况? 这是gridview页面上的下拉列表:

Some background: I have a dropdownlist on a master page that the user can use to select a different area of a business. On a gridview page I have set up a filter based on some code from the site: demo.evonet.au/GridviewwithFiltering.aspx[^] The issue I have is when a user changes the area on the master page the dropdownlist gets populate with the new values for the area and also retains the values from the previous Area. Example: Area A: AA, AB, AC the dropdownlist will only show those items. when the user selects Area B: BB, BC, BD the drop down will show BB, BC, BD, AA, AB, AC. How do I prevent this? Here is the Dropdownlist on the gridview page:

<asp:DropDownList ID="ddlLastName" DataSourceID="SqlDataSource2" AutoPostBack="True" DataValueField="LastName" runat="server" Width="120px" Font-Size="11px" AppendDataBoundItems="True" DataTextField="LastName"> <asp:ListItem Text="All" Value="%"></asp:ListItem> </asp:DropDownList> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:XXXConnectionString %>" SelectCommand="SELECT [LastName] FROM [Names] WHERE ([Site] = @Site) ORDER BY [LastName]"> <SelectParameters> <asp:ControlParameter ControlID="TextBox1" Name="Site" PropertyName="Text" Type="String" /> </SelectParameters> </asp:SqlDataSource>

推荐答案

ConnectionStrings:XXXConnectionString %> " SelectCommand =" 从[名称]的位置([站点] = @站点)中选择[姓氏]或按[姓氏]排序" > < SelectParameters > < asp:ControlParameter ControlID =" TextBox1" 名称 =" 网站" span> PropertyName =" 文本" 类型 =" 字符串" / > < /SelectParameters > < /asp:SqlDataSource > ConnectionStrings:XXXConnectionString %>" SelectCommand="SELECT [LastName] FROM [Names] WHERE ([Site] = @Site) ORDER BY [LastName]"> <SelectParameters> <asp:ControlParameter ControlID="TextBox1" Name="Site" PropertyName="Text" Type="String" /> </SelectParameters> </asp:SqlDataSource>

嗨 从下拉列表中删除 Hi Remove AppendDataBoundItems="True"

年龄,然后尝试. 希望这会有所帮助.

tage from your dropdownlist and try. Hope this helps.

更多推荐

在主页上更改dropdownlist时,dropdownlist为双精度值

本文发布于:2023-11-06 08:49:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563228.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:精度   主页   dropdownlist

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!