无法维护服务器控件中的状态 [英] Cant maintain state in a Server Control

查看:56
本文介绍了无法维护服务器控件中的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我创建的服务器控件有一些需要维护状态的属性。

Im creating a Server Control that has some properties that need to maintain state.

这是我的属性:

            public bool IsLoaded
            {
                get
                {
                    bool result = ViewState["Loaded"] != null ? (bool)ViewState["Loaded"] : false;
                    return result;
                }

                set
                {
                    ViewState["Loaded"] = value;
                }
            }

当页面加载时,IsLoaded属性设置为true,但是当我做一个回发,ViewState为空。

When the page loads the IsLoaded property is set to true, but when I do a postback the ViewState is null.

那么......我做错了什么?

So..what am I doing wrong??

谢谢!

高级.NET开发人员

推荐答案

请在 $ b $下发布asp.net问题b asp.net官方论坛,以便为您提供更好的帮助。
Please post asp.net questions under asp.net official forum for a better assistance on your case.


这篇关于无法维护服务器控件中的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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