Strange postback behavior of user controls

C

campwes

Hey there. I have a user control on an aspx page that displays data
based on a query (handled by another user control also on the page).
I've noticed that the first time I navigate to the page with the user
control, I can click on links, buttons etc on the user control and
navigate around. On subsequent postbacks, say when a user submits a
new query, the buttons and links on the user control are
"un-clickable". You get no click sound or functionality from the
buttons. I'll include the code for the container page below. What
could be going on here? By the way, the user control I'm complaining
about is called "viewQuestion".

TIA,

campwes

Public Class dmmQuestion
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Public WithEvents JumpToQuestionNumber1 As JumpToQuestionNumber
Protected WithEvents ViewQuestion1 As viewQuestion
Protected WithEvents dmmTopNav1 As dmmTopNav
Protected WithEvents lblChangesSaved As
System.Web.UI.WebControls.Label
Protected WithEvents phEvidMgmt As
System.Web.UI.WebControls.PlaceHolder
Protected WithEvents EvidMgmt1 As EvidenceManagement
Protected WithEvents dmmSideNav1 As dmmSideNav
Protected WithEvents dmmFooter1 As dmmFooter
Protected WithEvents phJump As
System.Web.UI.WebControls.PlaceHolder
Protected WithEvents phViewQuestionCtl As
System.Web.UI.WebControls.PlaceHolder
Protected WithEvents phSaveQuestionStatusCtl As
System.Web.UI.WebControls.PlaceHolder

'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()

End Sub

#End Region
Public sourcePage As dmm
Public newUCText As String

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

'Dim qLock As DMMLockUtil
'qLock.LOCK_EXPIRATION_MIN()

If Not IsPostBack Then
sourcePage = CType(Context.Handler, dmm)
ViewQuestion1 =
DirectCast(LoadControl("UserControls\viewQuestion.ascx"), viewQuestion)
phViewQuestionCtl.Controls.Add(ViewQuestion1)
ViewQuestion1.jumpCtlText = sourcePage.newUCText.ToString
ViewQuestion1.bind_dlQuestion()
Else
ViewQuestion1 =
DirectCast(LoadControl("UserControls\viewQuestion.ascx"), viewQuestion)
phViewQuestionCtl.Controls.Add(ViewQuestion1)
ViewQuestion1.Visible = False
End If

' Load the JumpToQuestion user control for the main page
JumpToQuestionNumber1 =
DirectCast(LoadControl("UserControls\JumpToQuestionNumber.ascx"),
JumpToQuestionNumber)
phJump.Controls.Add(JumpToQuestionNumber1)

' Persist the question number from the main to the question
page
'JumpToQuestionNumber1.txtQuestionNumber.Text =
ViewQuestion1.jumpCtlText

' Page level event handler
AddHandler JumpToQuestionNumber1.JumpToQuestionNumberEvent,
AddressOf TextBoxChanged

' Load the EvidenceManagement user control
EvidMgmt1 =
DirectCast(LoadControl("UserControls\EvidenceManagement.ascx"),
EvidenceManagement)
phEvidMgmt.Controls.Add(EvidMgmt1)
EvidMgmt1.AssessmentID = CStr(2)
EvidMgmt1.QuestionID = CStr(4)
End Sub

Public Sub TextBoxChanged(ByVal Sender As Object, ByVal e As
JumpToQuestionNumberEventArgs)
newUCText = e.UnvalidatedQuestionNumber
ViewQuestion1 =
DirectCast(LoadControl("UserControls\viewQuestion.ascx"), viewQuestion)
phViewQuestionCtl.Controls.Add(ViewQuestion1)
ViewQuestion1.jumpCtlText = newUCText
ViewQuestion1.bind_dlQuestion()
End Sub
End Class
 

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,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top