471,082 Members | 722 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,082 software developers and data experts.

Strange postback behavior of user controls

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\JumpToQuestio nNumber.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\EvidenceManag ement.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

Mar 31 '06 #1
0 1079

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Dot net work | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.