title: VB - Convert Web Site to Web Application
body: <p>This is my first time doing VB :-)  I've inherited a web site, which I've converted into a web application in VS2008.  The conversion has worked for everything except a Gallery control.</p>
  
  <p>The compile error I'm getting is: </p>
  
  <p>Type 'Gallery' is not defined in file:  gallery_oct07.aspx.designer.vb</p>
  
  <pre><code>Option Strict On
  Option Explicit On
  
  Partial Public Class gallery_oct07
  
      '''&lt;summary&gt;
      '''Gallery1 control.
      '''&lt;/summary&gt;
      '''&lt;remarks&gt;
      '''Auto-generated field.
      '''To modify move field declaration from designer file to code-behind file.
      '''&lt;/remarks&gt;
      Protected WithEvents Gallery1 As Global.Gallery
  End Class
  </code></pre>
  
  <p>with squiggly lines under Global.Gallery.</p>
  
  <p>The gallery_oct07.aspx.vb is:</p>
  
  <pre><code>Partial Class gallery_oct07
      Inherits System.Web.UI.Page
  
  End Class
  </code></pre>
  
  <p>And the gallery_oct07.aspx file:</p>
  
  <pre><code>&lt;%@ page language="VB" masterpagefile="~/MasterPage.master" autoeventwireup="false" inherits="WebApplication1.gallery_oct07" title="2007 Trip Photos" Codebehind="~/gallery_oct07.aspx.vb" %&gt;
  
  &lt;%@ Register Src="Gallery.ascx" TagName="Gallery" TagPrefix="uc1" %&gt;
  
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"&gt;
  &lt;script language="javascript" type="text/javascript" src="js/jquery-1.3.2.min.js"&gt;&lt;/script&gt;
  &lt;script language="javascript" type="text/javascript" src="js/thickbox.js"&gt;&lt;/script&gt;
      &lt;p class="title"&gt;
          Koru Care Christchurch Charitable Trust&lt;/p&gt;
      &lt;img src="images/green_space.gif" /&gt;
      &lt;p class="title"&gt;
          Trip Photos&lt;/p&gt;
      &lt;p class="subTitle"&gt;
          Los Angeles 2007&lt;/p&gt;
      &lt;p class="text"&gt;
          Click for larger Image&lt;/p&gt;
      &lt;uc1:Gallery ID="Gallery1" runat="server" ImageFolder="images/oct2007/"  /&gt;    
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>Gallery.ascx is:</p>
  
  <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" Codebehind="Gallery.ascx.cs" Inherits="WebApplication1.Gallery"%&gt;
  
  &lt;asp:Repeater runat="server" ID="rptGallery"&gt;
      &lt;HeaderTemplate&gt;
          &lt;ul class='&lt;%#CssClass%&gt;'&gt;
      &lt;/HeaderTemplate&gt;
      &lt;ItemTemplate&gt;
          &lt;li&gt;&lt;a href='&lt;%#ImageFolder + Eval("Name") %&gt;' class="thickbox" rel="gallery"&gt;&lt;img src='&lt;%#ImageFolder + "thumb/" + Eval("Name") %&gt;' /&gt;&lt;/a&gt;&lt;/li&gt;
              &lt;/ItemTemplate&gt;
      &lt;FooterTemplate&gt;
          &lt;/ul&gt;&lt;/FooterTemplate&gt;
  &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>and the code behind is:</p>
  
  <pre><code>using System;
  using System.IO;
  
  namespace WebApplication1
  {
      public partial class Gallery : System.Web.UI.UserControl
      {
          public string _ImageFolder;
          public string ImageFolder
          {
              get
              {
                  return _ImageFolder;
              }
              set
              {
                  _ImageFolder = value;
              }
          }
  
          private string _cssClass = "gallery";
  
          public string CssClass
          {
              get
              {
                  return _cssClass;
              }
              set
              {
                  _cssClass = value;
              }
          }
  
          protected void Page_Load(object sender, EventArgs e)
          {
  
              DirectoryInfo dir = new DirectoryInfo(MapPath(ImageFolder));
              FileInfo[] images = dir.GetFiles("*.jpg");
  
              rptGallery.DataSource = images;
              rptGallery.DataBind();
  
          }
  
          protected void Page_PreRender(object sender, EventArgs e)
          {
  
          }
      }
  }
  </code></pre>
  
  <p>The feels like a namespace issue.. My project namespace is WebApplication1.</p>
  
  <p>Cheers!</p>