Custom Control - LoadPostData Problem

Discussion in 'ASP .Net Building Controls' started by Frank Seibel, Dec 16, 2003.

  1. Frank Seibel

    Frank Seibel Guest

    Hi, I'm having a problem with a Custom Control that I've been working
    on, and could use some help.

    I have a custom built content editing site that I am working on and
    have written several custom controls for. They all work fine when I
    add the controls directly into an ASP.NET page (<control:name />), but
    I need to render these controls dynamically into the page depending on
    user navigation. The problem is that when these controls are
    rendered, after the user chooses which page he wants to work on and
    edits some data, the LoadPostData event is not firing for this
    control. Like I said if I load this control directly into an ASP.NET
    page then it's fine. Here is a sample of how the controls are
    rendered:

    Protected WithEvents psContentEditor as ctrlEditContent

    Public Sub ddlEditor_Change(ByVal sender As System.Object, ByVal e
    As System.EventArgs) Handles ddlEditor.SelectedIndexChanged
    Try
    Session("EditorId") = ddlEditor.SelectedItem.Value

    'Render the site
    LoadEditor()
    Catch errEx As Exception
    LogError(errEx)
    End Try
    End Sub

    Public Sub LoadEditor()
    Try
    Select Case Session("EditorId")
    Case 1
    'ctrlCurrentEditor = New ctrlEditContent()
    psContentEditor = New ctrlEditContent()
    psContentEditor.EnableViewState = True
    psContentEditor.ID = "ctrlEditor"
    '...load additional parameters here
    myPlaceHolder.Controls.Add(psContentEditor)

    Catch errEx as Exception
    LogError(errEx)
    End Try

    End Sub

    I have controls that are rendered similarly on other sites without any
    issues at all. But for some reason this site doesn't want to run the
    LoadPostData event for these controls.

    Any help would be appreciated.

    Thanks,
    Frank
     
    Frank Seibel, Dec 16, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. One Handed Man \( OHM - Terry Burns \)

    Custom Control & System.Web.UI.IPostBackDataHandler.LoadPostData

    One Handed Man \( OHM - Terry Burns \), Jun 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,983
    One Handed Man \( OHM - Terry Burns \)
    Jun 17, 2004
  2. dave
    Replies:
    0
    Views:
    198
  3. dave
    Replies:
    0
    Views:
    110
  4. Ralf Müller
    Replies:
    5
    Views:
    593
    Ashish Kaila
    Dec 10, 2004
  5. John Bailey

    LoadPostData not firing if control is in a formview

    John Bailey, Oct 23, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    183
    John Bailey
    Oct 23, 2005
Loading...

Share This Page