在主页上更改dropdownlist时,dropdownlist为双精度值 [英] dropdownlist double values when dropdownlist is changed on master page

查看:88
本文介绍了在主页上更改dropdownlist时,dropdownlist为双精度值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

某些背景:我在母版页上有一个下拉列表,用户可以用来选择公司的其他区域.

在gridview页面上,我基于网站上的一些代码设置了一个过滤器: http://demo.evonet.com. 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: http://demo.evonet.com.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 =" 名称 网站" span> =" 文本" 类型 =" > < /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为双精度值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆