System.Web.UI.Page.Request不存在 [英] System.Web.UI.Page.Request Not there

查看:93
本文介绍了System.Web.UI.Page.Request不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我键入了System.Web.UI.Page.Request但System.Web.UI.Page。只有3个属性:CreateHtmlTextWriterFromType,Equals和ReferenceEquals)。它是什么原因?谢谢。

I typed System.Web.UI.Page.Request but the System.Web.UI.Page. only has such 3 properties: CreateHtmlTextWriterFromType, Equals and ReferenceEquals). What is the reason for it? Thanks.

推荐答案

试试这样..



system.web。 ui.page 是一种类型。

。你应该创建实例来访问成员。



try like this..

system.web.ui.page is a type .
. you should create instance to access the members.

new  System.Web.UI.Page().Request










protected void Page_Load(object sender, EventArgs e)
      {
          if (!Page.IsPostBack)
          {
            Page.Request // here Page refers the current Instance..
          }
      }


这是类属性/方法和实例属性/方法之间的区别。

类属性/ mnethods只需通过类访问,而实例属性/方法需要该类的实例(新)。



请求 [ ^ ]是Page的非静态属性,因此需要Page的一个实例,以便访问。



干杯!
That is the difference between class properties/methods and instance properties/methods.
class properties/mnethods can be accessed simply via the class, while instance properties/methods need an instance (new) of that class.

Request[^] is an non static property of Page and thus needs an instance of Page in order to be accessible.

Cheers!


这篇关于System.Web.UI.Page.Request不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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