The if (!Page.IsPostBack) is always false went the page loads after i开发者_StackOverflow社区 click a linkbutton and it never goes into the linkbutton event. Desperately need help! Googled as much as I can. I am kinda new to asp
This is the code that i have in server:
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;
}
// and below..
<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>
Is the code part of a dynamically loaded UserControl? If so, in what stage of the asp.net lifecycle are you adding the UserControl?
If that is not the case, how do you access the Page?
精彩评论