Populating Codes Drop Down at Runtime Not Working.

Last post 04-16-2009, 6:41 AM by Kenneth. 3 replies.
Sort Posts: Previous Next
  •  04-15-2009, 4:24 AM 51105

    Populating Codes Drop Down at Runtime Not Working.

    Hi Adam,
     
    I have tried both the documentation example and my own code to clear and re-populate the codes drop down at runtime, neither of which are working.  Could you have a look at this please?
     
    Regards,
     
    Richard.
  •  04-15-2009, 1:06 PM 51122 in reply to 51105

    Re: Populating Codes Drop Down at Runtime Not Working.

    Richard,
     
    Can you check this example?
     
    dynamically populate the dropdown menu

    How to dynamically populate the dropdown menu?( C# | VB )

    This example demonstrates how to programmatically

     
    Will it work for you?

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-16-2009, 4:58 AM 51149 in reply to 51122

    Re: Populating Codes Drop Down at Runtime Not Working.

    Hi Adam,
     
    Ok so my first post wasn't very detailed!  I have now narrowed down the problem and also discovered another issue.  The code is as follows:
    1. Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load   
    2.     Dim assetsPath As String = Me.MapPath("~/assets")   
    3.   
    4.     With htmlContent   
    5.         .SetSecurityFilesGalleryPath(assetsPath)   
    6.   
    7.         'This method is not working in 6.3, but WAS working in 6.2   
    8.         .SetSecurityImageGalleryPath(assetsPath)   
    9.   
    10.         If Not .ToolControls("Codes"Is Nothing Then  
    11.             Dim richItem As CuteEditor.RichListItem   
    12.   
    13.             With CType(.ToolControls("Codes").Control, CuteEditor.RichDropDownList)   
    14.                 richItem = .Items(0)   
    15.                 .Items.Clear()   
    16.                 .Items.Add(richItem)   
    17.   
    18.                 .Items.Add("Test 1""Test 1")   
    19.                 .Items.Add("Test 2""Test 2")   
    20.                 .Items.Add("Test 3""Test 3")   
    21.             End With  
    22.         End If  
    23.   
    24.         'This line of code causes the drop downs to re-load their values from common.config   
    25.         .EditorWysiwygModeCss = Me.ResolveUrl(assetsPath & "/editor.css")   
    26.     End With  
    27. End Sub  
    If you just add a CuteEditor to the page and insert the above into the code-behind, you'll see that the Test 1, 2 & 3 items do not appear in the Codes drop down list.  If you then comment out line 25 it works as expected.
     
    Also it seems like line 8 isn't working anymore, although it works for FilesGallery and FlashGallery.  This was working in previous versions.
     
    Hope that helps, I have a testbed application that I can send to you if you are unable to replicate this issues detailed above.
     
    In the mean time, can I download 6.2 from somewhere until 6.3 is fixed?
     
    Regards,
     
    Richard.
  •  04-16-2009, 6:41 AM 51154 in reply to 51149

    Re: Populating Codes Drop Down at Runtime Not Working.

    Hi Trich,
     
    Typ this code:
     
    ------------------------------------->
      Protected Overloads Overrides Sub OnLoad(ByVal e As EventArgs)
       
            Dim assetsPath As String = Me.MapPath("~/assets")
            'EditorWysiwygModeCss properties need to set to a Virtual path and need to do this setting before the code below
            htmlContent.EditorWysiwygModeCss = "~//assets//editor.css"
       
            htmlContent.SetSecurityFilesGalleryPath(assetsPath)
        
            'This method is not working in 6.3, but WAS working in 6.2
            'if you want to set the path of 'insert image' button, you need to set SetSecurityImageBrowserPath
            htmlContent.SetSecurityImageBrowserPath(assetsPath)
       
            If (htmlContent.ToolControls("Codes") IsNot Nothing) Then
                Dim richItem As CuteEditor.RichListItem = Nothing
           
                If True Then
                    richItem = DirectCast(htmlContent.ToolControls("Codes").Control, CuteEditor.RichDropDownList).Items(0)
                    DirectCast(htmlContent.ToolControls("Codes").Control, CuteEditor.RichDropDownList).Items.Clear()
                    DirectCast(htmlContent.ToolControls("Codes").Control, CuteEditor.RichDropDownList).Items.Add(richItem)
               
                    DirectCast(htmlContent.ToolControls("Codes").Control, CuteEditor.RichDropDownList).Items.Add("Test 1", "Test 1")
                    DirectCast(htmlContent.ToolControls("Codes").Control, CuteEditor.RichDropDownList).Items.Add("Test 2", "Test 2")
                    DirectCast(htmlContent.ToolControls("Codes").Control, CuteEditor.RichDropDownList).Items.Add("Test 3", "Test 3")
                End If
            End If
       
       
            MyBase.OnLoad(e)
        End Sub
     
    --------------------------------------->
     
    Regards,
     
    Ken
View as RSS news feed in XML