如何在Visual Studio 2002下使用VB.NET保持ASP.NET中对象的持久性? [英] How do I maintain persistence of objects in ASP.NET using VB.NET under Visual Studio 2002?

查看:64
本文介绍了如何在Visual Studio 2002下使用VB.NET保持ASP.NET中对象的持久性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个具有出生日期和性别属性的人的对象.当回发为false时,我编写了一个aspx页面以在页面加载时创建人员对象.我创建了文本框以启用自动回发功能以接受出生日期和性别.我编写了一个文本更改事件,将输入的值分配给页面加载中创建的对象的属性.

但是,我收到错误找不到对象引用".我认为在页面更改中创建的对象在文本更改事件期间不会保留.

在这种情况下如何预示对象中值的持久性?
请提供代码示例指南.

谢谢.

I have created an object of a person with attributes for date of birth and gender. I wrote an aspx page to create an object of person on page load when postback is false. I created text boxes to accept date of birth and gender with autopost back enabled. I wrote a text changed event to assign the entered value to the properties of the object created in the page load.

However, I get the error "Object reference not found". I think the object created in page load is not persisted during the text change event.

How can I preseve persistence of values in the object in such cases?
Kindly guide with code example.

Thank you.

推荐答案

itagi写道:

但是,我得到了错误找不到对象引用".我认为在页面更改中创建的对象在文本更改事件期间不会保留.

However, I get the error "Object reference not found". I think the object created in page load is not persisted during the text change event.



如果它是成员变量,那是不可能的.页面加载首先发生,并且如果文本更改事件在SAME页面生命周期中,它不仅会消失.

如果不看代码,很难说更多.对象在生命周期之间不会持久存在,但在生命周期中不会消失.



If it''s a member variable, that is impossible. Page load happens first, and it won''t just disappear if the text change event is in the SAME page lifecycle.

It''s hard to say more without seeing your code. Objects do not persist between lifecycles, but they don''t disappear during one.


这篇关于如何在Visual Studio 2002下使用VB.NET保持ASP.NET中对象的持久性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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