ModalPopupExtender - update a label

Last post 07-02-2008 4:02 PM by mvang. 1 replies.

Sort Posts:

  • ModalPopupExtender - update a label

    06-30-2008, 10:34 AM
    • Member
      251 point Member
    • red
    • Member since 06-19-2002, 4:24 AM
    • Posts 52

    Hi all,

    I'm Trying to display the new added row id just added to DB using the ModalPopupExtender.

    I'm passing the value for the new id to a label inside a panel for the Popup, but I get the viewstate (old value) from the the label control.

    I can understand the reason for this, label will be updated when the page is loaded.

    I was trying to do it from generating javascript on the client and from code behind, but did not make it. 

    is there a way to do this?

    Cheers.

    <cc1:ModalPopupExtender ID="mpeSummary" runat="server" BehaviorID="programmaticModalPopupBehavior"
            TargetControlID="hiddenTargetControlForModalPopup" PopupControlID="savePopup"
            BackgroundCssClass="modalBackground" DropShadow="True" PopupDragHandleControlID="programmaticPopupDragHandle"
            RepositionMode="RepositionOnWindowScroll">
        </cc1:ModalPopupExtender>
        <script type="text/javascript">
        function updatePopUP(newID)
        {
             $get('<%=lblNewID.ClientID%>').innerHTML = newID;
             $find('<%= mpeSummary.ClientID %>').show(); 
        }
        </script>
        <asp:Panel runat="server" CssClass="modalPopup" ID="savePopup" Style="display: none;
            width: 350px; padding: 10px">
            <asp:Panel runat="Server" ID="programmaticPopupDragHandle" Style="cursor: move; background-color: #DDDDDD;
                border: solid 1px Gray; color: Black; text-align: center;">
                טופס נשמר!<br />
                מספר:
                <asp:Label ID="lblNewID" runat="server" ForeColor="red"></asp:Label>
            </asp:Panel>
            <asp:LinkButton runat="server" ID="hideModalPopupViaServer" Text="סגור" OnClick="hideModalPopupViaServer_Click" CausesValidation="false" /> 
            <br />
        </asp:Panel>
     

    C#

    lblNewID.Text= e.OutputParameters["NewID"].ToString();
    mpeSummary.Show();
     
    RED
  • Re: ModalPopupExtender - update a label

    07-02-2008, 4:02 PM
    Answer
    • Participant
      1,708 point Participant
    • mvang
    • Member since 12-27-2007, 1:59 PM
    • Mid West
    • Posts 361

    Try using the Register DataItems of the ScriptManager and then in the Javascript that is referenced by the ScriptManager, add the new value to the label.

     

    "If you have knowledge, let others light their candles in it."
    — Margaret Fuller
Page 1 of 1 (2 items)