Re: Customize Images, Links, Code Snippet Dropdowns

  •  02-09-2004, 12:26 PM

    Re: Customize Images, Links, Code Snippet Dropdowns

    I found code in the samples that shows how to add items to these drop downs:


    Public Sub Page_Load(sender As object, e As System.EventArgs)

     

     Dim contactstring As String    
     contactstring = "Contact us"  
      
     Editor1.StyleDropDown.Items.Add(new ListItem("Style 1","Heading"))
     Editor1.StyleDropDown.Items.Add(new ListItem("Style 2","Head"))
     Editor1.StyleDropDown.Items.Add(new ListItem("Style 3","Subhead"))
     Editor1.StyleDropDown.Items.Add(new ListItem("Style 4","NormalRed"))
     Editor1.StyleDropDown.Items.Add(new ListItem("Style 5","Comment"))

     
    End Sub


    I am using the editor in a datagrid in the edit template and the footer(new item).  I have the editor functioning correctly, but the population of these dropdowns, using the above code causes the following error:


    Object reference not set to an instance of an object.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [NullReferenceException: Object reference not set to an instance of an object.]
       sailfish.Manage_News.Page_Load(Object sender, EventArgs e) +52
       System.Web.UI.Control.OnLoad(EventArgs e) +67
       System.Web.UI.Control.LoadRecursive() +35
       System.Web.UI.Page.ProcessRequestMain() +731
    


    Any ideas why this is happening?

View Complete Thread