动态更改ModalPopupExtender面板的内容

时间:2018-09-09 14:10:02

标签: html asp.net vb.net

我有一个按钮“ DeleteRequest”。单击此按钮时,我想显示模式弹出面板“ Panel2”。 Panel2具有标签“ DeleteRequestMessage”。我想从后台代码动态更改标签文本,并运行一些代码。

我遇到的问题是,Panel2显示在:标签文本更改和代码运行之前。

aspx页面如下:

<%@ Page Language="VB" MasterPageFile="~/MasterPages/MyMasterPage.master" AutoEventWireup="false" CodeFile="ShowPostingDetails.aspx.vb" Inherits="Pending_ShowPostingDetails"  MaintainScrollPositionOnPostback="true" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.
.
.
</style>
    
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CpMainContent" Runat="Server">

    <!-- Required jQuery Reference -->
<script type="text/javascript" src="<%= ResolveUrl("~/jquery/js/jquery-1.8.2.min.js")%>"></script>
    <!-- Idle Timer Plugin Reference -->
<script type="text/javascript" src="<%= ResolveUrl("~/jquery/js/idle-timer.min.js")%>"></script>    

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePartialRendering="true">
    </asp:ToolkitScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <ContentTemplate>
.
.
.
<asp:ImageButton ID="DeleteRequest" runat="server" Width="50px" CssClass="CommentButton" ImageUrl="~/Images/DeleteComment.png" ToolTip="حذف طلب تمديد مهلة الإجابة"  />
.       
.
.
<asp:panel id="Panel2" runat="server" CssClass="auto-style13" Height="131px" Width="520px" Style="display:none">
                <table width="100%" class="auto-style12">
                    <tr>
                        <td align="center" colspan="4" class="auto-style16">
                            <asp:Label ID="DeleteRequestMessage" runat="server" CssClass="auto-style17" Height="45px" Text="Label" Width="450px"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4" align="center">
                            <asp:Button ID="ClosePanel2" runat="server" BackColor="#6262FF" CausesValidation="False" ForeColor="White" Height="40px" onMouseOut="this.className='Buttonout'" onMouseOver="this.className='Buttonhover'" style="text-align: center; font-size: 28px;  font-family: sc_AMEEN; margin-left: 0px;
                            -moz-border-radius: 15px;-webkit-border-radius: 15px;border-radius: 15px;" Text="استمرار" UseSubmitBehavior="False" Width="167px" />
                        </td> 
                    </tr>
                </table>
            </asp:panel>
        
           
            <asp:ModalPopupExtender ID="ModalPopupExtender2" runat="server" OkControlID="ClosePanel2" PopupControlID="Panel2" DropShadow="true" TargetControlID="DeleteRequest" BackgroundCssClass="modalBackground">
            </asp:ModalPopupExtender>

    </ContentTemplate> 
    </asp:UpdatePanel> 

在显示Panel2及其要根据变量值“ DeletingRequestMessage”动态更改的内容之前,我想运行的事件代码如下:

Protected Sub DeleteRequest_Click(sender As Object, e As ImageClickEventArgs) Handles DeleteRequest.Click

        Dim DeletingRequestMessage As String

        If Session("RequestStatus") <> "بالانتظار" Then
            DeletingRequestMessage = "لا يمكن حذف الطلب لأنه تم اتخاذ الإجراء بشأنه"
            DeleteRequestMessage.Text = DeletingRequestMessage
            GoTo DeleteRequestSkip
        End If

        If CInt(Session("RequestingUserIndx")) = TDClass.GetLoggingUserIndxValue(Session("username")) Or TDClass.CheckDataEntryRight(Session("username"), Session("RequestingUnitIndx")) Then
            DeletingRequestMessage = "حذف طلب تمديد مهلة الإجابة"
            DeleteRequestMessage.Text = DeletingRequestMessage
            PerformRequestDeletion()
        Else
            DeletingRequestMessage = "صلاحية حذف طلب تمديد مهلة الإجابة غير متوفرة"
            DeleteRequestMessage.Text = DeletingRequestMessage
        End If




DeleteRequestSkip:
        ModalPopupExtender2.Show()

    End Sub

那么如何解决此问题,因此我可以先运行PerformRequestDeletion()过程,然后向Panel2显示带有变量值DeletingRequestMessage的标签消息?

请非常感谢

0 个答案:

没有答案