I wrote a test flowchart program using goView object. It works fine when the View is called directly in a standard alone aspx. But when I use it in a ascx user control, javascript error happens in goWebImage.axd. The following are the content in goWebImage.axd:
If I do View Source and open the HTML, I got the correct Client ID too such as:
0,53,389,94,41,'pointer');
OK, when I look at the JavaScript returned by GoWebImageHandler.FindSessionViewData, which is written to HttpContext.Response.OutputStream, it looks just as we both expect – with the qualified name including the user control ID.
This is my aspx:
This is my ascx:(wfb_flowchart_UC.ascx)
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="wfb_flowchart_UC.ascx.vb" Inherits="iq.wfb_flowchart_UC" %> <%@ Register TagPrefix="goweb" Namespace="Northwoods.GoWeb" Assembly="Northwoods.GoWeb" %> <goweb:goview id="GoView1" runat="server" bordercolor="Blue" borderwidth="2px" height="275px" width="416px" NoPost="True" ImagePage="GoWebImage.axd" ScriptFile="GoWeb.js" CssFile="none"></goweb:goview>I got it! The error only happens when sessionState is “StateServer”. Everything works fine if sessionState is “InProc”.
You have to make sure everything is serializable. There are a number of topics in this forum where that has been the factor causing things to fail.
But as you can see, my 2 test pages are extremely simple. Can you give me any suggestion that how to make this simple example work in “stateServer” mode? In my sample, what shall I do to make everything serializable? Thanks a lot.
Make sure all your classes are marked [Serializable] or <Serializable()>.
Since my sample is very simple, I added <Serializable()> before the class name in both of the code behind files. Still, the javascript happens when the view is clicked. In this sample, I did not use any of my class. It is just a GoView class.
I am looking at it. Thanks a lot.