ASP.Net page enter key causing post back

前端 未结 6 553
眼角桃花
眼角桃花 2020-12-02 23:40

I have an aspx page that postsback when it should not. there are two text boxes, two listboxes and two buttons on the page. if at any-point the enter key is pressed the firs

6条回答
  •  忘掉有多难
    2020-12-02 23:44

    • You could set the DefaultButton on the Form or a Panel. This way you have full control what happens.
    • Set UseSubmitBehavior="False" on your Buttons. This disables the "AutoPostback" on Enter.

    I would prefer the second if i wanted to prevent Postbacks on Enter completely.

提交回复
热议问题