OK, men det er nemmere selv at lave en ny side:
1) smid en ny dropdown liste på en aspx side (autopostback=true,viewState=true)
2) smid en ny submit knap på en aspx side
3) Dobbleklik på dem en af gangen og skriv en response.write() i event handleren.
4) åbn siden i en browser og vælg først en ny værdi for dd listen. event handler fanger eventen og udskriver whatever i response.write()
5) klik på knappen og både koden i event handleren for knap OG DD liste bliver fyret af.....
KODE (aspx side):
<%@ Page language="c#" Codebehind="WebForm2.aspx.cs" AutoEventWireup="false" Inherits="HCL.WebForm2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm2</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="
http://schemas.microsoft.com/intellisense/ie5"> </HEAD>
<body MS_POSITIONING="GridLayout">
<form id="WebForm2" method="post" runat="server">
<asp:DropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 347px; POSITION: absolute; TOP: 177px" runat="server" AutoPostBack="True">
<asp:ListItem Value="10">10</asp:ListItem>
<asp:ListItem Value="20">20</asp:ListItem>
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 526px; POSITION: absolute; TOP: 398px" runat="server" Text="Button"></asp:Button>
</form>
</body>
</HTML>
KODE (code behind file):
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
Response.Write("drop down event");
}
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("button event");
}