A page can have only one server-side Form tag.

后端 未结 1 1678
后悔当初
后悔当初 2021-01-15 06:19

Masterpage.aspx

    
    
    
    

        
相关标签:
1条回答
  • 2021-01-15 07:08

    Master pages should not contain form tags in general because they are meant to be used only as the base layout of your content page. Remove the form tag from the Master page and the error will go away.

    If you want to define a common "Login" section for all your pages (this appears to be your intent), you can instead create a UserControl to do this. You would then define a section inside your Master page to contain this user control making sure that the ContentPlaceHolder of the Login UserControl always ends up enclosed inside the content page's form. That way, when you submit the form, the btnlogin_Click1 click event is triggered.

    In conclusion: re-arrange your page in a way that you have one form tag per page, since ASP.NET does not allow having more than one and try to define your form's inside the content pages and not the Master page.

    0 讨论(0)
提交回复
热议问题