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 ****ted 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