ASP.NET/HTML: HTML button's onClick property inside ASP.NET (.cs)

前端 未结 5 1728

I just wanna find out if there\'s a way to put my onClick event inside .cs:

5条回答
  •  青春惊慌失措
    2020-12-14 08:53

    btnLogin.Click += new EventHandler( btnLogin_Click );

    will assign the btnLogin_Click event handler to the button's Click event.

    however, I would point out that assigning a handler in the markup of the aspx page does not "expose your codes", as the HTML rendered down to the client doesn't have any of that information in it.

提交回复
热议问题