通过动态创建的RadWindow,PostBack在page_load上调整Radwindow

时间:2019-02-14 21:00:51

标签: asp.net vb.net radwindow

我正在动态创建RadWindow,因此在创建RadWindow之后,该RadWindow中会有一个按钮。还有一个复选框可以发回。单击按钮后,Radwindow会进行一些保存。但是发回邮件并重新加载后,我的radwindow会稍微向右移动吗?

父页面

Private Sub btnAddSupervision_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddSupervision.Click
    getWindow("Add", False)
End Sub

Private Sub getWindow(Title As String, IncludeSupervision As Boolean)

    Dim PageUrl As String = "~/Supervision_Edit.aspx"

    Menuradwindow.Windows.Clear()
    Menuradwindow.VisibleOnPageLoad = False
    Dim newWindow As New RadWindow()
    newWindow.AutoSize = True
    newWindow.VisibleOnPageLoad = True
    newWindow.Modal = False
    newWindow.MaxWidth = 800


    Menuradwindow.Windows.Add(newWindow)
    newWindow.DestroyOnClose = True
    newWindow.BorderWidth = 1
    newWindow.Behaviors = WindowBehaviors.Default
    newWindow.BorderStyle = BorderStyle.None
    newWindow.VisibleStatusbar = False
    newWindow.Title = Title


    newWindow.NavigateUrl = PageUrl & "?SupervisionID=" & SupervisionID & "&StaffRosterID=" & StaffRosterID & "&ButtonID=" & Title

End Sub

ChildRadWindow页面

Private Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init


    ModalButton1.Visible = False
    ModalButton2.Visible = False
    ModalButton3.Visible = False
    ModalButton4.Visible = False
    ModalButton5.Visible = False


    ButtonTextID = (Request.QueryString("ButtonID")).ToString


    If Not ButtonTextID = _Add Then
        currSupervisionID = (Request.QueryString("SupervisionID"))
        currStaffRosterID = (Request.QueryString("StaffRosterID"))
    End If

    'view data, to create dynamic controls
    If ButtonTextID = _Add Then
        PopulateCheckBox("[spGet_Supervision_SupervisedStaff]")
        BuildQuestionControl(pnlQuestionsForSupervisor, "[spGet_Supervision_QuestionsForSupervisor]")
        pnlQuestionsForStaff.Visible = False

    ElseIf ButtonTextID = _Acknowledge Then
        BuildQuestionControl(pnlQuestionsForSupervisor, "[spFill_Supervision_ViewQuestionsForSupervisior]", "@SupervisionID", currSupervisionID, "@StaffRosterID", currStaffRosterID)
        pnlQuestionsForSupervisor.Enabled = False
        BuildQuestionControl(pnlQuestionsForStaff, "[spGet_Supervision_QuestionsForStaff]", "@SupervisionID", currSupervisionID, "@StaffRosterID", currStaffRosterID)
        dtpSupervisionDate.Enabled = False
    ElseIf ButtonTextID = _View Then
        BuildQuestionControl(pnlQuestionsForSupervisor, "[spFill_Supervision_ViewQuestionsForSupervisior]", "@SupervisionID", currSupervisionID, "@StaffRosterID", currStaffRosterID)
        pnlQuestionsForSupervisor.Enabled = False
        BuildQuestionControl(pnlQuestionsForStaff, "[spFill_Supervision_ViewQuestionsForStaff]", "@SupervisionID", currSupervisionID, "@StaffRosterID", currStaffRosterID)

        pnlQuestionsForStaff.Enabled = False
        btnSubmit.Visible = False
        dtpSupervisionDate.Enabled = False
    End If



End Sub

Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
    Page.Validate()
    If Page.IsValid Then
        If ButtonTextID = _Add Then
            ' SaveSupervision()
            ' SaveSupervisionStaff()
        ElseIf ButtonTextID = _Acknowledge AndAlso Not chkNoComment.checked = True Then
            ' SaveAcknowledgeQuestions()
        End If

        ScriptManager.RegisterStartupScript(Page, Me.GetType, "refreshParent", "refreshParent(); ", True)
    Else
        ScriptManager.RegisterStartupScript(Me, Me.GetType, "Error", "alert('Please make sure all fields are filled.');", True)

    End If
End Sub

0 个答案:

没有答案
相关问题