A CodeBehind error with User Controls

by Terry 6/11/2008 3:29:00 PM

I am updating a website for my project at work. It was a .Net 1.1 site converted to a .Net 2.0 site. We are adding some new user controls to the site. I implemented one of those controls on a new page and generated a runtime error like this:

"The base class includes the field 'WebUserControl1', but its type (common_WebUserControl) is not compatible with the type of control (ASP.common_webusercontrol_ascx)"

Hunting around with Google turned up several possibilities, but none helped until I found this link, http://forums.asp.net/t/960707.aspx. A post by ‘Maduka’ suggested changing the Codefile attribute of the page to CodeBehind. This worked in my case. It works the other way too. Change the control’s CodeBehind property to CodeFile.

Without digging deep, I would presume that CodeFile is the .Net 2.0+ code behind method, as this is the default value for the new user controls. So, in our implementation, we are changing pages that use the new controls to use the CodeFile attribute instead of CodeBehind. I am not sure which is best practice, but this is what works for me. Your mileage may vary.

And, it turns out I may have this backward. Reading the posts a bit more indicates that CodeBehind is the new model. I will need to look at this more closely. I am hoping to update the site to .Net 3.5 by the end of the year, and I would like to clean this stuff up.

Currently rated 1.5 by 111 people

  • Currently 1.459461/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Coding Practices | computing

Chronological PostList control code posted

by Terry 5/8/2008 2:03:00 PM

I uploaded the code for the chronological PostList control I modified for this site. You can download the code from my Chronological PostList control for BlogEngine.Net page.

Currently rated 1.5 by 2 people

  • Currently 1.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

BlogEngine.NET

Mac Clones and other random notes

by Terry 4/14/2008 6:59:00 PM

Psystar sells a $399 Mac clone
"Why spend $1999 to get the least expensive Apple computer with a decent video card when you can pay less than a fourth of that for an equivalent sleek and small form-factor desktop with the same hardware,” says a note on the company Web site.
...
"There may be another problem for Psystar on the horizon. Apple’s end user license agreement states that 'You agree not to install, use or run the Apple Software on any non-Apple-labeled computer, or to enable others to do so.'"

Which I find interesting. Psystar is not offering anything but hardware that is functionally identical with what Apple offers. That is not a violation of any software license in itself. If I attempt to install OS X on non-Apple hardware, then I am technically in violation of the Apple agreement, but owning the hardware is no problem.


Karen and I spent most of the weekend preparing Karen's mother's home for sale. Karen helped clean and I moved boxes, packed loads into storage and played with attending children. We should hear if we need to paint and otherwise stage the home next weekend. The sort of it is, I did not work on our house this weekend, nor did I work on the martial arts lesson plans I need to complete. I will start that tonight and throughout the week.


I am working on a one-off data feed for a project at work. I am posting data for an outside vendor on a monthly cycle. I choose to use the SQLXML extension for IIS. This pulls and supplies the data from a data warehouse with a SQLXML template. This is useful because the template can incorporate additional data about the feed, like when it was generated as well as format the output.

I am writing a C#, .Net 2.0, application that will run as a scheduled task to periodically generate the data to a static file system, create an historical archive and manage directory cleanup and error notification. The static XML files can be opened in Excel as is. I am providing an Excel document that automatically opens the current file and formats the data. I will post the framework for all this in a static page on my site when it is complete. Rather simple, but elegant in some ways.

The SQLXML template looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<DataFeed xmlns:sql='urn:schemas-microsoft-com:xml-sql'>
  <FeedProperties>
   <PublicationDateUTC>
     <sql:query>SELECT convert(varchar(22), GetUTCDate(), 126)</sql:query>
  
</PublicationDateUTC>
   <ArchiveDateName>
    
<sql:query>SELECT convert(varchar(22), GetUTCDate(), 112) + '.xml'</sql:query>
  
</ArchiveDateName>
  </FeedProperties>
  <sql:query >
    SELECT *
    FROM MANAGERS
    FOR XML AUTO
  </sql:query>
</DataFeed>

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About Terry Losansky

Terry Dee Losansky

I am a software architect, actively practice and teach martial arts and live in Snoqualmie, Washington. I have an amazing daughter who is the jewel of my life.

E-mail me Send mail
Terry's Facebook profile

Calendar

<<  November 2017  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Sign in