le dropdown (metto solo le prime due).
in DefaultValueField ho messo il campo int che collega le tabelle:
codice:
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlGruppi" DataTextField="descrizione"
DataValueField="soluzione#" AutoPostBack="True" AppendDataBoundItems="True">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlGruppi" runat="server" ConnectionString="<%$ ConnectionStrings:MYTELENEWS %>"
SelectCommand="SELECT * FROM [soluzioni]"></asp:SqlDataSource>
<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlSoluzioni" DataTextField="descrizione"
DataValueField="gruppo#" AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlSoluzioni" runat="server" ConnectionString="<%$ ConnectionStrings:MYTELENEWS %>"
SelectCommand="SELECT * FROM [gruppi] WHERE ([soluzione#] = @column1)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" DefaultValue="soluzione#" Name="column1"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
codice che ho messo per aggiungere il primo elemento:
codice:
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.Items.Insert(0, new ListItem("*", ""));
DropDownList2.Items.Insert(0, new ListItem("*", ""));
DropDownList3.Items.Insert(0, new ListItem("*", ""));
}