Button events do not fire on asp.net

If if (! Page.IsPostBack) is always false, the page loaded after clicking the link button and it never goes to the linkbutton event. Help desperately needed! Ruined as much as possible. I'm new to asp

This is the code I have on the 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>
                &nbsp;<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>
+3
source share
1 answer

Is part of dynamically loaded UserControl code? If so, at what stage in the asp.net life cycle do you add UserControl?

If this is not the case, how do you access the page?

0
source

Source: https://habr.com/ru/post/1792775/


All Articles