in effetti ti hanno già risposto; non so se ti possa servire. E' il classico REGIONI-PROVINCE
codice:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
libreria.ModuloWeb.FillListControl(this.regioni, MioModulo.StringaConnessioneTest, "regioni", "NOME_REGIONE", "CODICE_ISTAT_REGIONE");
this.regioni.SelectedIndex = 0;
this.regioni_SelectedIndexChanged(this.regioni, EventArgs.Empty);
}
}
protected void regioni_SelectedIndexChanged(object sender, EventArgs e)
{
string codice_istat_regione = ((DropDownList)sender).SelectedValue;
string sql = string.Format("SELECT * FROM Q_PROVINCIE WHERE CODICE_ISTAT_REGIONE = \"{0}\" ", codice_istat_regione);
libreria.ModuloWeb.FillListControl(this.province, MioModulo.StringaConnessioneTest, sql, "nome_provincia", "CODICE_ISTAT_PROVINCIA");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Pagina senza titolo</title>
<link href="../stili/Styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<table>
<tr>
<td>regioni</td>
<td>province</td>
</tr>
<tr>
<td><asp:DropDownList ID="regioni" runat="server" AutoPostBack="true" OnSelectedIndexChanged="regioni_SelectedIndexChanged"></asp:DropDownList></td>
<td><asp:DropDownList ID="province" runat="server" Width="187px"></asp:DropDownList></td>
</tr>
</table>
</form>
</body>
</html>