问题描述
这是一个 Visual Studio 问题.我觉得所有有用的 Intellisense 应该有一些帮助,但我似乎找不到它.
This is a bit of a Visual Studio question. I feel with all the helpful Intellisense there should be something to assist but I can't seem to find it.
我在 VS2008 的 ASP.NET C# 中创建了一个带有代码隐藏的页面,它当然会自动生成一个 PageLoad 事件方法.那么,如果我想为 PageLoad 之外的更多事件添加方法怎么办?我认为 Foo.aspx 页面上会有一些可能的方法事件处理程序列表要添加.难道没有更多可能像PageInit,PageDispose,(或等效)等......?我在哪里可以找到这些?
I made a page with a codebehind in ASP.NET C# in VS2008 and it autogenerates a PageLoad event method, of course. Well, what if I want to add methods for more events besides PageLoad? I would think there would be some list on the Foo.aspx page of possible method event handlers to add. Aren't there more maybe like PageInit, PageDispose, (or equiv) etc...? Where can I find these?
编辑 - 我当然可以在 api 中查找方法名称.我正在寻找一个方便的快捷方式来在 Visual Studio 中添加这些.如果它产生一个,它不能产生其他的吗?
EDIT - I can of course look up the method names in the api. I'm looking for a handy shortcut to add these in Visual Studio. If it generates one, can't it make others?
推荐答案
- 在解决方案资源管理器中,右键单击页面并从上下文菜单中选择查看组件设计器"
- 打开属性面板/窗口(按 F4)
- 现在点击黄色箭头/flash 图标,您将看到所有页面事件的列表
- 双击要为其添加处理程序的事件
我很确定还有另一种方法(从设计器视图开始),但我无法重现它.
I'm pretty sure there was another way (starting from the designer view), but I can't reproduce it.
我通常不使用页面事件处理程序,而是覆盖相应的方法(例如 OnLoad 而不是 Page_Load).要实现这些覆盖之一,您只需在代码隐藏中键入覆盖",然后按 space 即可获取可以覆盖的方法列表.
I usually do not use the page event handlers, instead I override the corresponding methods (e.g. OnLoad instead of Page_Load). To implement one of these overrides, you can simply type "override" in the code-behind and press space to get a list of methods that you can override.
这篇关于如何在 Visual Studio 2008 中为 ASP.NET 添加页面事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)