VB - Convert Web Site to Web Application
Posted
by Dave
on Stack Overflow
See other posts from Stack Overflow
or by Dave
Published on 2010-03-18T02:36:05Z
Indexed on
2010/03/18
2:41 UTC
Read the original article
Hit count: 297
vb.net
Hi
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.
The compile error I'm getting is:
Type 'Gallery' is not defined in file: gallery_oct07.aspx.designer.vb
Option Strict On
Option Explicit On
Partial Public Class gallery_oct07
'''<summary>
'''Gallery1 control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents Gallery1 As Global.Gallery
End Class
with squiggly lines under Global.Gallery.
The gallery_oct07.aspx.vb is:
Partial Class gallery_oct07
Inherits System.Web.UI.Page
End Class
Gallery.ascx is:
<%@ Control Language="C#" AutoEventWireup="true" Codebehind="Gallery.ascx.cs" Inherits="WebApplication1.Gallery"%>
<asp:Repeater runat="server" ID="rptGallery">
<HeaderTemplate>
<ul class='<%#CssClass%>'>
</HeaderTemplate>
<ItemTemplate>
<li><a href='<%#ImageFolder + Eval("Name") %>' class="thickbox" rel="gallery"><img src='<%#ImageFolder + "thumb/" + Eval("Name") %>' /></a></li>
</ItemTemplate>
<FooterTemplate>
</ul></FooterTemplate>
</asp:Repeater>
and the code behind is:
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)
{
}
}
}
The feels like a namespace issue.. My project namespace is WebApplication1.
Cheers!
© Stack Overflow or respective owner