Sure,
(but in my app. i don't use a submit button, i'm using the
AutoPostBack to fire the event when selection changed)
Code:
======
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication_to_delete_this_Proj.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp

ropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 128px; POSITION: absolute; TOP: 152px"
runat="server" AutoPostBack="True">
<asp:ListItem Value="0">0</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
</asp

ropDownList>
<asp

ropDownList id="DropDownList2" style="Z-INDEX: 102; LEFT: 240px; POSITION: absolute; TOP: 152px"
runat="server" AutoPostBack="True">
<asp:ListItem Value="8">8</asp:ListItem>
<asp:ListItem Value="9">9</asp:ListItem>
<asp:ListItem Value="10">10</asp:ListItem>
</asp

ropDownList>
<asp:Button id="Button1" style="Z-INDEX: 103; LEFT: 136px; POSITION: absolute; TOP: 96px" runat="server"
Text="call empty handler"></asp:Button>
</form>
</body>
</HTML>
when the C# WebForm1.aspx.cs is:
================================
================================
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace WebApplication_to_delete_this_Proj
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.DropDownList DropDownList2;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);
this.DropDownList2.SelectedIndexChanged += new System.EventHandler(this.DropDownList2_SelectedIndexChanged);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
}
private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
Response.Redirect("WebForm2.aspx");
}
private void DropDownList2_SelectedIndexChanged(object sender, System.EventArgs e)
{
Response.Redirect("WebForm3.aspx");
}
}
}
* while WebForm2 and WebForm3 are just empty pages
* to see which event triggers
so, when WebForm1 loads, i'm changing selection in dropdownlist1 which causes the handler to call response.Redirect("WebForm2.aspx"),
then, clicking back in the IE window, and selecting some item from dropdownlist2 (or pressing the button),
DropDownlist1 handler is invoked (and not the item I clicked...)
Thanks,
P.