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

VSLive 2008, Day two

by Terry 5/13/2008 8:54:00 AM

I am frustrated with the network access at the conference. Yesterday morning I had great access for the first third of the day then I shut down my laptop during a break. I have not had access since. I learned from the conference organizers they only had five IP addresses being issued for the wireless access. Apparently that has not been fixed – my luck. So, I am writing this offline. If I get it posted, then I found access someplace.

The conference starts formally today, yesterday being pre-conference classes. I have little to comment on the keynote this morning, except one statistic that was mentioned. The speaker said, from years of research by Microsoft, that 35% of all projects fail. This value has not changed over 20 years. What has changed is that the relative cost of failed projects has decreased. In short, development projects have not gotten more successful over time, but just fail more cheaply.

The solution, I presume from the keynote, is integrated team suits like Microsoft Team Foundation Server and Visual Studio will somehow herald in a new era of success. I find that interesting, but I am mostly doubtful. I would agree the integrated development systems are a needed improvement to the development lifecycle. I also believe this will make teams, successful or otherwise, function more effectively, productively and by inference with less cost. This will continue to drive development costs down, making successful and failed projects less costly.

What will not happen, I think, with any tool improvement will be an increase in successful projects vs. failed. I believe the ratio of failures stems largely from the analysis phase of a project, and secondly the architectural phase. Basically, developers are problem solving mechanics and rely on the proper analysis of a problem in order to solve it. Note, I am not saying that developers have no ownership in the failures. Good analysis should include some developer skill set. Errors in the initial analysis will eventually cause cost, quality or schedule problems in the future and no amount of utopian project management and code integration will help that, just make the errors apparent sooner, and therefore less costly.

If you assume the cost of error-recovery in the architecture and development phases can be reduced to almost nothing that projects will be more successful, there may be hope. This will not address poor assumptions or understanding of customer requirements in the analysis. If you don’t know what your customer needs, no amount of money, time or development effort will meet that unknown unless you get lucky. Luck is not a good bet.

If you see this, obviously I found network access. The convention IT folks dropped the network and restarted it.

Currently rated 2.0 by 3 people

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


Coding Practices

Chronological posting and coding practices

by Terry 4/9/2008 8:35:00 AM

I managed to re-figure how to get my posts to display in chronological order. I butchered the PostList control in the 'User Controls' into a new control. This is simple enough, really. Changing the loop to reverse the posts in the paged list of posts seemed to work. I will post the new control once I test it out enough.

Naturally, I am working in the worst possible way to write code. I have no source control for my code, I have no backup scheduled, I have no plan or documentation on what I plan to do and I am basically hacking at the code. I know better, and will remedy all that soon.

Source control is vital, even if there is only one developer working on code. It is the recovery, version history and comparison tool that will save hours of work. I have many stories, good and bad, on the benefits of source control. One development team which works in a related area at my office does not use a formal source control system. In three years they have only had one issue – that I know of – which required going to tape backup to recover lost files. That is one event too many. It took two or three days to get the files recovered and not all the lost work had been backed up. A source control database would have prevented that entirely.

The company project I am currently working on is a fairly good example of development best-practices realized. The development team, five years ago, was largely SEI/CMMI level 1. In a preliminary audit conducted yesterday, the development and project teams are sitting at level 3 or maybe 4. I created new change request during the audit to address minor issues to get us to the next level.

The point is, for those who are struggling with SEI/CMMI, is it is not about writing documentation, it is about following processes that reinforce best-practices; most of which all developers already know are the right thing to do.

So, to that end, I need to get my personal projects in order. I know it is the right thing to do and experience has shown me that it pays off well.

Currently rated 1.7 by 21 people

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



Powered by BlogEngine.NET
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


<<  June 2021  >>

View posts in large calendar

Recent comments



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

© Copyright 2021

Sign in