3
if(!Page.IsPostBack)始終爲false在單擊鏈接按鈕後頁面加載並且它永遠不會進入linkbutton事件。迫切需要幫助!儘可能地使用Google搜索。我還挺新到ASP按鈕事件不會在asp.net中觸發
這是我在服務器代碼:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
SetDefaultView();
}
}
private void SetDefaultView()
{
MultiView1.ActiveViewIndex = 0;
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 0;
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 1;
}
//及以下..
<td>
<asp:LinkButton ID="LinkButton1" runat="server"
onclick="LinkButton1_Click">Tab1</asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">Tab2</asp:LinkButton>
</td>
它的MVC ASP.Net和添加按鈕使用工具箱,並雙擊按鈕,以獲得事件 – 2011-02-21 07:05:51