Home All Groups Group Topic Archive Search About

HtmlImage becoming HtmlGenericControl in converted 2003 project

Author
7 Dec 2006 7:20 PM
belvario
Hi -

We are converting a VS 2003 project to VS 2005 and we are encountering
the following problem - all HTML IMG tags that were marked
runat="server" in the old project (and were declared as HtmlImage in
the codebehind) are coming up in the new project as
HtmlGenericControls.  Actually, the HtmlImage declarations were all
removed from the original project by the conversion process, and what's
happening is the partial class that is created at compile time is
interpreting the IMG tags as generic controls for us.  We get compile
errors when setting the Src property, for instance, since it's not part
of HtmlGenericControl.

I have even created a super-simple example in 2003 that also does the
same thing when we attempt to convert to 2005 (compiles and runs fine
in 2003, breaks in 2005):

WebForm1.aspx -
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="imgtest.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html>
  <head>
    <title>WebForm1</title>
    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name=vs_defaultClientScript content="JavaScript">
    <meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
  </head>
  <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
      <img ID="imgTest" runat="server />
    </form>
  </body>
</html>



WebForm1.aspx.cs -

using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;

namespace imgtest
{
    public class WebForm1 : Page
    {
        protected HtmlImage imgTest;

        private void Page_Load(object sender, EventArgs e)
        {
            imgTest.Src = "foo.gif";
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent()
        {
            this.Load += new EventHandler(this.Page_Load);
        }
        #endregion
    }
}

Please help!  This is driving us crazy....

Cheers,
Andy Evans

AddThis Social Bookmark Button