Coder Social home page Coder Social logo

devexpress-examples / how-to-return-values-from-the-aspxpopupcontrols-contentcollection-and-close-the-popup-on-bot-e3084 Goto Github PK

View Code? Open in Web Editor NEW
0.0 55.0 3.0 36 KB

Add an editor to the popup control's content collection, get the editor's value, and close a pop-up window on the client or server.

License: Other

C# 7.61% ASP.NET 83.86% Visual Basic .NET 8.53%
dotnet navigation layout multi-purpose-controls asp-net content editor popup-window

how-to-return-values-from-the-aspxpopupcontrols-contentcollection-and-close-the-popup-on-bot-e3084's Introduction

Popup Control for ASP.NET Web Forms - How to return values from the content collection and close the pop-up window on the client or server

This example demonstrates how to add an editor to the popup control's content collection, get the editor's value, and close a pop-up window on the client or server.

Return values and close popup

Overview

Create a popup control, use its ContentCollection property to specify the control's content, and populate a pop-up window with a text box editor and two buttons.

<dx:ASPxPopupControl ID="popup" runat="server" ClientInstanceName="popup">
    <ContentCollection>
        <dx:PopupControlContentControl runat="server">
            <dx:ASPxTextBox ID="textBox" runat="server" ClientInstanceName="textBox" />
            <table>
                <tr>
                    <td>
                        <dx:ASPxButton ID="btnClient" runat="server" Text="Client" AutoPostBack="False" ClientInstanceName="btnClient">
                            <ClientSideEvents Click="OnBtnClientClick" />
                        </dx:ASPxButton>
                    </td>
                    <td>
                        <dx:ASPxButton ID="btnServer" runat="server" Text="Server" OnClick="btnServer_Click" />
                    </td>
                </tr>
            </table>
        </dx:PopupControlContentControl>
    </ContentCollection>
</dx:ASPxPopupControl>

To close the pop-up window, call the control's Hide method on the client side or set the ShowOnPageLoad property to false on the server side.

function OnBtnShowPopupClick() {
    popup.Show();
}
function OnBtnClientClick(s, e) {
    popup.Hide();
    ShowInfo('Client', textBox.GetText());
}
function ShowInfo(closedBy, returnValue) {
    alert('Closed By: ' + closedBy + '\nReturn Value: ' + returnValue);
}
protected void btnServer_Click(object sender, EventArgs e) {
    popup.ShowOnPageLoad = false;
    string startUpScript = string.Format("ShowInfo('Server', '{0}');", textBox.Text);
    Page.ClientScript.RegisterStartupScript(this.GetType(), "ANY_KEY", startUpScript, true);
}

You can also get the editor's value to display it in an alert message.

Files to Review

More Examples

how-to-return-values-from-the-aspxpopupcontrols-contentcollection-and-close-the-popup-on-bot-e3084's People

Contributors

devexpressexamplebot avatar elenapeskova avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.