Hi Azim,
I have a master table relationship, i.e. depending on what is selected in the dropdown list the grid show the relevant data.In the database there are several identical entries for the Position field, for instance there are four marketing managers that have different name. How can i group the identical Position name in the dropdown and when selected the grid should display all marketing managers. Thank you. Here is the code:
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="sqlDdl"
DataTextField="ID" DataValueField="Postion">
</asp:DropDownList>
<asp:GridView ID="grid" runat="server" AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="sqlCon" EnableModelValidation="True">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<%-- <asp:BoundField DataField="Postion" HeaderText="Postion"
SortExpression="Postion" />--%>
<asp:BoundField DataField="Cell" HeaderText="Cell" SortExpression="Cell" />
<asp:BoundField DataField="Birthday" HeaderText="Birthday"
SortExpression="Birthday" />
</Columns>
</asp:GridView>
<br />
<asp:SqlDataSource ID="sqlCon" runat="server"
ConnectionString="<%$ ConnectionStrings:BlogConnectionString %>"
SelectCommand="SELECT * FROM [GG_Sam] WHERE ([ID] = @ID)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="ID"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="sqlDdl" runat="server"
ConnectionString="<%$ ConnectionStrings:BlogConnectionString %>"
SelectCommand="SELECT [ID], [Postion] FROM [GG_Sam]"></asp:SqlDataSource>