Hi RayMilhon,
Please refer the sample below.
HTML
<asp:DropDownList ID="ddlCustomers" runat="server" DataSourceID="SqlDataSource1"
DataTextField="Name" DataValueField="Name" AutoPostBack="true" OnSelectedIndexChanged="OnCustomerChanged">
<asp:ListItem Text="--Please select--" Value=""></asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>"
SelectCommand="SELECT Name FROM Customers"></asp:SqlDataSource>
Code
C#
protected void OnCustomerChanged(object sender, EventArgs e)
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('" + ddlCustomers.SelectedItem.Text + "')", true);
}
VB.Net
Protected Sub OnCustomerChanged(sender As Object, e As System.EventArgs) Handles ddlCustomers.SelectedIndexChanged
'SqlDataSource1.SelectCommand = "SELECT Name FROM Customers WHERE Name = '" & ddlCustomers.SelectedItem.Text & "'"
ClientScript.RegisterClientScriptBlock(Me.GetType(), "alert", "alert('" & ddlCustomers.SelectedItem.Text & "')", True)
End Sub