これがうまくいくことを願っています.当面の間、私は usercontrol で単一の Button コントロールを使用しています:
ASCX ファイル:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="buttonl.ascx.cs"Inherits="Controls_buttonl" %>
<asp:Button ID="Button1" runat="server" Text="Button user control"
onclick="Button1_Click" />
ASCX.cs ファイル:
protected void Button1_Click(object sender, EventArgs e)
{
if (this.ID == "buttonl1")
{
//perform action according to panel1
}
else if (this.ID == "buttonl2")
{
//perform action according to panel2
}
}
ASPX ページ (親ページ) :
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server" Height="99px" Width="224px">
<uc1:buttonl ID="buttonl1" runat="server" />
</asp:Panel>
</div>
<div>
<asp:Panel ID="Panel2" runat="server" Height="97px" Width="222px">
<uc1:buttonl ID="buttonl2" runat="server" />
</asp:Panel>
</div>
</form>
それでも目標に到達できない場合はお知らせください。