在 VS2017 中双击 asp.net 按钮不会创建事件处理程序 [英] Double clicking asp.net button in VS2017 doesn't create event handler

查看:30
本文介绍了在 VS2017 中双击 asp.net 按钮不会创建事件处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经 4 年没有编码了,现在又重新开始了.我想知道为什么当我双击一个按钮在 webform 上创建事件处理程序时,事件处理程序不会在 VS2017 中自动生成.另外,当我为按钮编写事件处理程序时,在我尝试以最终用户身份使用该按钮后单击该按钮时,该处理程序仍然不会触发.我什至在编写的按钮事件处理程序中设置了断点,以便在调用函数时检查我的代码,但没有运气.

I haven't coded in 4 years and I am getting back into it. I was wondering why, when I double click a button to create an event handler on a webform, that the event handler is not generated automatically inside VS2017. Plus, when I wrote a event handler for the button, the handler still doesn't fire when the button is clicked after I try to use the button as an end user. I even set break points in the written button event handler to check out my code as it calls functions, and no luck.

我一直在寻找解决方案,但没有找到.是否有我需要的 VS2017 补丁或者我可以回滚 VS2017 更新?

I have looked for a solution but I didn't find one. Is there a VS2017 patch I need or can I roll back a VS2017 update?

谢谢!

PS - 我现在残疾了,并试图再次通过编程恢复我的生活.这绝对是一个缓慢的过程.

PS - I am now disabled and trying to get my life back through programming again. It definitely is a slow process.

推荐答案

在设计器(设计视图或源视图)中选择按钮时,打开属性"窗口.在属性顶部的小工具栏上单击闪电图标.这将显示该控件的所有事件.在 Click 事件旁边双击(您已经为按钮指定了 ID,是吗?)您的 click 事件将出现在代码窗口中,并带有一个将其连接到按钮的 Handles 子句.顺便说一句,欢迎使用 Stack Overflow.

When your button is selected in the designer (either design view or source view) open the Properties window. On the little tool bar at the top of the properties click the lightning bolt icon. This will display all the events for that control. Double click beside the Click event (you have given your button an ID, yes?) Your click event will appear in the code window with a Handles clause that hooks it up to the button. BTW, Welcome to Stack Overflow.

这篇关于在 VS2017 中双击 asp.net 按钮不会创建事件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆