An error occurred while creating the datalist subclass control in ASP. NET 2.0.

Source: Internet
Author: User

NearIn ASP. NET 2.0, A webcontrols dynamic library previously developed with. NET 1.1 is used. Two controls are inherited from the DataGrid and datalist, and the following creation error occurs:

This control is normal in ASP. NET 1.1. If you do not care about this error, you can also use it as usual, and everything works normally during running.

From the Problem description, make sure allPropertiesAre valid. ", it seems that there is a problem with the properties of the control. SetCodeI checked it carefully and found no errors. Is this creation error caused by some changes to webcontrol in ASP. NET 2.0? But there is nothing wrong with the runtime ..

At this time, the "AutoFormat" function in smarttag was accidentally selected, but another error message was accidentally found:


"Cannot create an object of Type 'hooyee. utils. pagerinfo'" from its string representation ''for the 'pagerinfo' property ."

It means that the pagerinfo object cannot be created through an empty string value of the pagerinfo attribute. It turns out that this property has an error.

Pagerinfo is a class used to save and calculate paging information. Because my datalist supports the paging function, this attribute is added.

In my understanding, the system may want to save the content of pagerinfo attribute D in HTML as text, and then deserialize or recreate a pagerinfo instance using this string value. However, my pagerinfo class does not implement serialization or reload the tostring () method, so it cannot save its value as a string type.

Because the pagerinfo attribute itself does not need to be stored in HTML, so my solution is to addDesignerserializationvisibilityattributeThis feature controls how a property is serialized during design. I am hidden here, so I won't serialize it.

[Designerserializationvisibility (designerserializationvisibility. Hidden)]

Public Pagerinfo {Get {Return_ Pagerinfo}}  


After re-compilation, the problem is solved. I have not tried to add the serialization function for the pagerinfo class. I think this problem can be solved as well. If you are interested, try it.

__________________________________ 2005/01/25
the advdatalist control and pagerinfo control mentioned in this article are all used in the webpager paging control. The control is now available for source code download.
A set of embedded or independently used paging controls: webpager (source code included)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.