Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • CodeMaster2008 151 posts 184 karma points
    Jul 02, 2010 @ 11:58
    CodeMaster2008
    0

    Creating a dropdownlist macro parameter

    I created this really simple macro parameter whicn is a dropdownlist that read it's value from a xml file and it appears to be working. The only problem is after save the macro and load it again, the previows saved value won't appear selected.

    So, everytime i load the macro to change something i have to remeber to set this parameter again.
    Could somebody tell me what I missed?

    Imports System.Web.UI.WebControls
    Imports umbraco.interfaces
    Imports System.Web

    Public Class RssChannelPicker
    Inherits System.Web.UI.WebControls.DropDownList
    Implements IMacroGuiRendering

    #Region "Properties"

    Public ReadOnly Property ShowCaption As Boolean Implements umbraco.interfaces.IMacroGuiRendering.ShowCaption
    Get
    Return True
    End Get
    End Property

    Public Property Value As String Implements umbraco.interfaces.IMacroGuiRendering.Value
    Get
    Return Me.SelectedValue
    End Get
    Set(ByVal value As String)
    Me.SelectedValue = value
    End Set
    End Property

    #End Region

    #Region "Events"

    Private Sub RssChannelPicker_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
    If Me.Items.Count = 0 Then
    Dim helper As New SharedFunctions
    helper.LoadSettings("RSSChannels.config", Me)
    End If
    End Sub

    #End Region

    End Class

     

  • CodeMaster2008 151 posts 184 karma points
    Jul 04, 2010 @ 09:15
    CodeMaster2008
    0

    I got that.
    The "set property" occurs before the "Init" so, the list is still empty.
    I just changed it to something like:

        Public Property Value As String Implements umbraco.interfaces.IMacroGuiRendering.Value
           
    Get
               
    Return Me.SelectedValue
           
    End Get
           
    Set(ByVal value As String)

                helper
    .LoadSettings("RSSChannels.config", Me)
               
    Me.SelectedValue = value
           
    End Set
       
    End Property

     But i appreciate if somebody point me to an event that occurs before the property are sets, so i don't have to call "LoadSettings" on all properties.

Please Sign in or register to post replies

Write your reply to:

Draft