Subclassing GoView in ASP.NET 2.0

Newbie question I’m sure, but I’m missing one little bit of knowlege.
I’m trying to replace my GoView with a subclassed version, along the lines of what Kinlan is doing in this post: oview+size
This will expose a few new properties/methods that aren’t in the GoView.
Got my new class ok, but how do I actually use it on the web page? (It’s actually an ascx, not aspx page, in a DotNetNuke application)
Changing the tag
<%@ Register TagPrefix=“goweb” Namespace=“Northwoods.GoWeb” Assembly=“Northwoods.GoWeb” %>
at the top of the page to something like
<%@ Register TagPrefix=“goweb” Namespace=“MyNamespace” Assembly=“MyAssembly” %>
isn’t helping. I’ve tried the assembly/namespace of my web app (where my class lived), also tried creating a new assembly which references all the Go DLL’s & pointing my web app’s references to that (and still the Go DLL’s)
Any help will save my project!

I’m not sure what’s wrong in your app, but the TreeApp sample web app does subclass GoView and refer to it in the ASPX page.
What is the error, anyway?

There seems to be a problem with the TreeApp sample too, at least with the VB version. The directive…
<%@ Register TagPrefix=“TreeApp” Namespace=“TreeApp” Assembly=“TreeApp” %>
…points to ‘TreeApp’, but the name of the assembly is TreeAppVB. Easy enough to fix, but I can’t get it to work in ASP.NET 2.0 for other reasons (seems like something doesn’t like the Cassini development web server)
Anyhow, looking at the code, I’ve been taking the right approch in my app, but still no luck. Here’s what I’ve got…
Web page source looks like this now:
<%–<%@ Register TagPrefix=“goweb” Namespace=“Northwoods.GoWeb” Assembly=“Northwoods.GoWeb” %>–%>
<%@ Register TagPrefix=“ei” Namespace=“ei.Editor” Assembly=“DotNetNuke” %>
… and the control is now …
<ei:GoViewAutoSize id=“MyGoView” runat=“server” Width=“800px” AllowSelect=“False” AllowResize=“False” AllowReshape=“False” AllowMove=“False” AllowMouse=“False” AllowLink=“False” AllowKey=“False” AllowInsert=“False” AllowEdit=“False” AllowDelete=“False” AllowCopy=“False” Height=“350px” />
In the project I have class file…
Imports Microsoft.VisualBasic
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.ComponentModel
Imports System.Collections
Imports Northwoods.GoWeb
Namespace ei.Editor
<Serializable()> _
Public Class GoViewAutoSize
Inherits GoView

End Class
End Namespace
The first error is on the page iteself 'Unknown server tag ‘ei.GoViewAutoSize’
From there, anywhere in the code-behind I reference Me.MyGoView the error is ‘MyGoView’ is not a member of ‘ei.Editor.View’ (View is the partial class behind the page)
So it seems to me it can’t find the new class.

Hmmm, in 2.4.1 the assembly reference had already been corrected to be “TreeAppVB”, so I’m guessing you have an older version.
I don’t have any problems upgrading and running the 2.4.1 WebSamplesVB\TreeApp in VS 2005.

By the way, if you’re just trying to have the GoView automatically resize itself to maximize its width in the browser window, you could define this JavaScript function:
function MaximizeWidth(id) {
var img = document.getElementById(id);
if (img != null) {
var w = window.innerWidth;
if (!w) w = document.body.scrollWidth;
if (!w) w = document.width;
w -= 20;
if (w < 100) w = 100;
goSize(w, img.height, id);
img.width = w;
and call it when the BODY loads:

... Caveat: I haven't tried this in 2.3 or earlier, but I know it works in the upcoming 2.5 release, since we have updated some of the sample web apps to do exactly that.

Yes, I have 2.3.1
That function looks promising and that IS what I am trying to do, but as this is on an ascx page, I don’t have a BODY I can call if from. Any other ideas?
Will 2.5 support GoView’s Height / Width properties set to 100% ?
If not, I’d like to suggest it. It seems really strange that this is the only control I’ve seen that can’t stretch itself properly to fill it’s parent container.
That one feature would help me get my management to pony-up for an upgrade!

Maybe it would work to define that onload event handler in the HTML rendered by your ASCX control.
The reason it can’t support % for Width or Height is that what is shown is actually an element. On the server we have to generate an actual image file (well, it’s streamed to the client so it doesn’t reside on disk) and thus we need to know exactly how big to make the image. That requires pixel measurements, since we don’t want there to be any stretching/shrinking of the image on the client, and since we don’t know how big the user’s window is to know what 100% really means.