Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

DropdownList with control parameter

$
0
0

Hi

I have dropdownlist when user select the value it shows the data for that city. i am using controlParameter. here is the code.

<asp:SqlDataSource ID="ApprsRegion" runat="server" ConnectionString="<%$ ConnectionStrings:strConn %>"
            ProviderName="<%$ ConnectionStrings:strConn.ProviderName %>" SelectCommand="SELECT  Name , regionid FROM regionname order by name"></asp:SqlDataSource><asp:SqlDataSource ID="Appraiserlist" runat="server" ConnectionString="<%$ ConnectionStrings:strConn %>"
            ProviderName="<%$ ConnectionStrings:strConn.ProviderName %>" SelectCommand="SELECT [FirstName] + ' ' + [LastName] AS name ,[CompanyName], [BusPhone],[Busfax],[EmailAddress]
                            FROM [Citylist] ap
                            JOIN [Region] ar On ap.citylistid = ar.cityid
                            where province = 'ON'
                            and rn.regionid =@regionid"><SelectParameters><asp:ControlParameter ControlID="DropDownList1" Name="regionid" PropertyName="SelectedValue" /></SelectParameters></asp:SqlDataSource><div class="row"><div class="span12"><h1>Ontario City</h1></div></div><div class="row"><div class="span12"><form runat="server"><asp:DropDownList ID="DropDownList1" DataSourceID="ApprsRegion" runat="server"
DataTextField="name" DataValueField="regionid" AutoPostBack="true" ></asp:DropDownList>


 Now what i want to do is, when user select ALL value from the Dropdownliist it should show all, I do not want to pass @regionId in the where clause should have only Province = 'ON' then it will show the all values. Can you please tell me how i can get this? something like in where clause without @regionID

 

<asp:SqlDataSource ID="Appraiserlist" runat="server" ConnectionString="<%$ ConnectionStrings:strConn %>"
            ProviderName="<%$ ConnectionStrings:strConn.ProviderName %>" SelectCommand="SELECT [FirstName] + ' ' + [LastName] AS name ,[CompanyName], [BusPhone],[Busfax],[EmailAddress]
                            FROM [Citylist] ap
                            JOIN [Region] ar On ap.citylistid = ar.cityid
                            where province = 'ON'>

thanks

 


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>