Custom Control - LoadPostData Problem

F

Frank Seibel

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top