Cannot set a DefaultButton on a usercontrol

后端 未结 3 875
迷失自我
迷失自我 2021-01-26 05:26

I am trying set a button on a user control as defaultbutton on a page but its not working. Here is the code for my user control



        
3条回答
  •  感情败类
    2021-01-26 05:59

    under what circumstances are you expecting the btnSubmit Click event to fire?

    I ask because the event will only be triggered if the Enter key is pressed when a control which implements the IButtonControl interface has focus.

    This would include (among others) TextBox and DropDownList.

    If you select your DropDownList and then hit enter it should fire the event. But just clicking any element (such as a DIV) and hitting enter would not.


    Edit (Based on comment)

    Its a bit of a hack but you can achieve what you ask using the following javascript (uses JQuery):

    
    

提交回复
热议问题