私は同様の問題を抱えていました、そして私はこれを試します、
<asp:Panel id="myPanel" runat="server" DefaultButton="ButtonID">
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server" >
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</asp:View>
<asp:View ID="View2" runat="server">
<asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" />
</asp:View>
</asp:MultiView>
</asp:Panel>
</div>
</form>
protected void Page_Load(object sender, EventArgs e)
{
myPanel.DefaultButton = "Button1";
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("View1 Button is clicked");
MultiView1.ActiveViewIndex = 1;
myPanel.DefaultButton = "Button2";
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Write("View2 Button is clicked");
MultiView1.ActiveViewIndex = 0;
}
あなたを助けるかもしれません。