当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - The 'controlType' attribute must be specified on the 'adapter' tag

问题描述:

I want to store view state data in server side .

<browsers>

<browser refID="Default">

<controlAdapters>

<adapter ControlType="System.Web.UI.Page" adapterType="ServerSideViewStateAdapter" />

</controlAdapters>

</browser>

while compiling solution im getting below error

The 'controlType' attribute must be specified on the 'adapter' tag.

I'm unable to use System.Web.UI.Page namespace in visual studio 2008

网友答案:

It is a typo I guess. Change the attribute name from ControlType to controlType. It should be small c.

网友答案:

Ensured the adapterType attribute matches the class namespace that was created for ViewStateAdapter.

<controlAdapters>
  <adapter controlType="System.Web.UI.Page" adapterType="ServerSideViewStateAdapter" />
</controlAdapters
网友答案:

To mantain view state in server side create one class file in app_code

using System.Web.UI.Adapters;
 public class ServerSideViewStateAdapter:PageAdapter
    {
        public override PageStatePersister GetStatePersister()
        {
           // return base.GetStatePersister();
            return new SessionPageStatePersister(this.Page);
        }

    }

and add browser folder - in browser folder add browser file- e.g"ViewStateAdapter" and add this code in that file

 <browsers>
    <browser refID="Default">
        <controlAdapters>
            <adapter controlType="System.Web.UI.Page" adapterType="ServerSideViewStateAdapter" />
        </controlAdapters>
    </browser>
    </browsers>
分享给朋友:
您可能感兴趣的文章:
随机阅读: