Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Others
cms.evaluation
cms.general
comm.businessdesk
comm.campaigns_csf
comm.catalog
comm.datawarehousing
comm.deploy.
comm.general
comm.sdk
comm.solutionsites
comm.userprofilemgt
commerce.analysis
crm
crm.deployment
crm.developer
hiserver.general
mobility.miserver
sharep.portal.config
sharep.portal.dev
sharep.portal.docmgmt.
sharep.portal.installation
sharep.portal.sdk
sharep.portal.search
sharep.team.caml
sharep.teamservices
sharep.windowsservices
sharep.winservices.dev
sharepoint.portalserver
siteserv.knowledgemgr
siteserver.analysis
siteserver.commerce
siteserver.css
siteserver.general
siteserver.publishing
siteserver.sdk
siteserver.search
site-server.site-mgmt
site-server.webpost
  
 
date: Wed, 11 Jun 2008 08:00:02 -0700,    group: microsoft.public.cmserver.general        back       


Custom Console Control Error   
Hi all,

I have a custom console item (item sort action) from the old gotdotnet site. 
It worked fine in .net 1.x but now i've ported it to .net 2.0 i get the 
following error:

The property cannot be accessed before the Control.OnInit() phase. 

Line 16:             Get
Line 17:                 If Me.Available Then
Line 18:                     Return "CMS_openWindowPageProperties('" + 
Me.UrlNewWindow + "');" <-- Error
Line 19:                     
Me.Page.Response.Redirect(CmsHttpContext.Current.Posting.UrlModeUnpublished, 
True)
Line 20:                 Else
 
The code running this is:

    Public Class ItemSortAction
        Inherits BaseNewWindowAction

        Dim _siteName As String
        Dim DIALOG_ROOT_PATH As String = siteName + "CustomDialogs/"

        Public Overrides ReadOnly Property ActionJavascript() As String
            Get
                If Me.Available Then
                    Return "CMS_openWindowPageProperties('" + 
Me.UrlNewWindow + "');"
                    
Me.Page.Response.Redirect(CmsHttpContext.Current.Posting.UrlModeUnpublished, 
True)
                Else
                    Return String.Empty
                End If
            End Get
        End Property

        Private Sub ItemSortOrder_Init(ByVal sender As Object, ByVal e As 
System.EventArgs) Handles Me.Init
            MyBase.OnInit(e)
            Me.UrlNewWindow = DIALOG_ROOT_PATH + 
"ItemOrdering.aspx?NRMODE=Update&ChannelGuid=" + 
Page.Server.UrlEncode(CmsHttpContext.Current.Channel.Guid)
        End Sub

        Public Overloads Overrides ReadOnly Property Available() As Boolean
            Get
                Dim canSortOneItem As Boolean = False
                Dim cmsContext As CmsHttpContext = CmsHttpContext.Current
                Dim colItems As ChannelAndPostingCollection = 
cmsContext.Channel.AllChildren
                For Each currItem As ChannelItem In colItems
                    If currItem.CanSetProperties Then
                        canSortOneItem = True
                        ' break 
                    End If
                Next
                Return (MyBase.Available AndAlso canSortOneItem)
            End Get
        End Property

        Public Overrides Property Text() As String
            Get
                Return "Sort Menu Items"
            End Get
            Set(ByVal Value As String)

            End Set
        End Property


        ''' <summary>
        ''' Public property used to get the string name for the correct site
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property siteName() As String
            Get
                Return _siteName
            End Get
            Set(ByVal Value As String)
                _siteName = Value
            End Set
        End Property

    End Class

Thanks for any help in advance,

Michael
date: Wed, 11 Jun 2008 08:00:02 -0700   author:   drazic19 am

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us