如何在Visual Studio 2008中添加页面事件的ASP.NET [英] How do I add Page Events for ASP.NET in Visual Studio 2008

查看:88
本文介绍了如何在Visual Studio 2008中添加页面事件的ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个有点Visual Studio的问题。我所有有用的智能感知感觉应该有一些帮助,但我似乎无法找到它。

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#中的codebehind,它会自动生成一个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?

推荐答案


  • 在Solution Explorer中,右键单击页面,然后从上下文菜单中选择查看组件设计器

  • 打开属性面板/窗口(preSS <大骨节病> F4

  • 现在,单击黄色箭头/闪存图标,你会看到所有页面事件的列表

  • 双击您要添加处理程序的事件

我是pretty肯定有另一种方式(从设计视图开始),但我不能复制它。

I'm pretty sure there was another way (starting from the designer view), but I can't reproduce it.

我通常不使用网页事件处理程序,而是我覆盖了相应的方法(例如:的OnLoad 而不是的Page_Load )。为了实现这些优先选项之一,你可以简单地在code-后面,$ P $键入覆盖PSS <大骨节病>空格得到的,你可以重写方法的列表。

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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