路过一个DropDownList的选定值在ASPX参数 [英] passing selected value of a dropdownlist to a parameter in aspx

查看:119
本文介绍了路过一个DropDownList的选定值在ASPX参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网格,dropdownlist.I希望通过dropdownlist.How我能做到这一点的选择在网格中筛选值?
我的code是这样

I have a grid and dropdownlist.I want to filter values in a grid by the selection of dropdownlist.How Can i do this? My code is like this

<asp:DropDownList ID="DDLVisitedVol" runat="server" AutoPostBack="true" DataSourceID="DsVisitedVol"
            DataTextField="VisitedVol" DataValueField="VisitedVol" 
            Width="244px">
        </asp:DropDownList>

 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString=""
           ProviderName=""
            SelectCommand="SELECT [ID],[UserName], [Email], [visitedVol] FROM [HitTracker] where visitedVol=@VisitedVol ">
        <SelectParameters>
                <asp:Parameter Name="VisitedVol" Type="String"/>
        </SelectParameters>

我如何可以通过下拉列表来@VisitedVol选定值。
如果有人知道请帮助我。
感谢您

How can i pass the selected value of dropdown list to @VisitedVol . If anyone knows pls help me. tHANK YOU

推荐答案

使用ControlParameter:

Use ControlParameter:

<asp:ControlParameter ControlID="DDLVisitedVol" Name="VisitedVol" PropertyName="SelectedValue"  Type="String"/>

这篇关于路过一个DropDownList的选定值在ASPX参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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