[IronPython] Tips for IronPython for ASP.Net (IronPython 2.6 Beta 1)

Dody Gunawinata empirebuilder at gmail.com
Wed May 27 08:35:29 CEST 2009


1. ViewState property is not available in UserControl (this is a bug) but
this is easily rectified. Just create an assembly that inherits
from Microsoft.Web.Scripting.UI.ScriptUserControl

public class ScriptUserControlBase :
Microsoft.Web.Scripting.UI.ScriptUserControl
{

        public StateBag ViewState
        {
            get { return base.ViewState; }
        }
     }

and then modify your web.config

    <pages compilationMode="Auto"

 pageParserFilterType="Microsoft.Web.Scripting.UI.NoCompileCodePageParserFilter"
               pageBaseType="XXX"
               userControlBaseType="YYYY" >

and replace the userControlBaseType from the standard to
ScriptUserControlBase. It will then work normally.

ViewState is available up in the hierarchy in System.Web.UI.Control, but
since it is protected, it is not available for the code behind code. This
brings us to the second tip.

2. The page behind can only access *public *methods/members from the parent
class container. This is a change of behavior from the previous version of
IP for  asp.net.

Other than that, everything else looks dandy. Enjoy.


Dody Gunawinata
-- 
nomadlife.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090527/0faebff4/attachment.html>


More information about the Ironpython-users mailing list