-->
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowControlParameterEx01.aspx.cs" Inherits="LearnAsp.Net.ControlDemo.DataBound.ShowControlParameterEx01" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Show Control Parameter</title> </head> <body> <form id="form1" runat="server"> <div> <h2 style="color: Teal"> ControlParameter Example</h2> <asp:DropDownList ID="ddlDeptCategory" DataSourceID="srcDeptCategories" DataTextField="Name" DataValueField="id" runat="server" /> <asp:Button ID="btnSelect" Text="Select" ToolTip="Select Department" runat="server" /> <hr /> <asp:GridView ID="grdEmployee" DataSourceID="srcEmployee" ForeColor="SlateGray" BackColor="Snow" BorderColor="HotPink" runat="server" /> <asp:SqlDataSource ID="srcDeptCategories" ConnectionString="<%$ ConnectionStrings:constrOracle %>" ProviderName="System.Data.OracleClient" SelectCommand="SELECT department_id id,department_name Name FROM departments where rownum <=10 " runat="server" /> <asp:SqlDataSource ID="srcEmployee" ConnectionString="<%$ ConnectionStrings:constrOracle %>" ProviderName="System.Data.OracleClient" runat="server" SelectCommand=" select * from employees WHERE department_id =:id"> <SelectParameters> <asp:ControlParameter ControlID="ddlDeptCategory" Name="id" Type="Int16" /> </SelectParameters> </asp:SqlDataSource> </div> </form> </body> </html>
Thanks for reading Asp.Net DataSource Controls with Parameter