Back to Devexpress

BootstrapClientCallbackPanel.PerformCallback(parameter) Method

aspnetbootstrap-js-bootstrapclientcallbackpanel-dot-performcallback-x28-parameter-x29.md

latest5.3 KB
Original Source

BootstrapClientCallbackPanel.PerformCallback(parameter) Method

Sends a callback to the server and generates the server-side BootstrapCallbackPanel.Callback event, passing it the specified argument.

Declaration

ts
PerformCallback(
    parameter: string,
    onSuccess?: (arg: string) => void
): void

Parameters

NameTypeDescription
parameterstring

A string value that represents any information that needs to be sent to the server-side BootstrapCallbackPanel.Callback event.

| | onSuccess | (arg: string) => void |

A client action to perform if the server round-trip completed successfully.

|

Remarks

Use the PerformCallback method if you need to asynchronously go to the server and perform some server-side processing using AJAX-based callback technology. You can pass the required information which can be collected on the client side as a string of arguments (for instance, in the “Name = Value;” form) via the PerformCallback method’s parameter parameter. The onSuccess parameter allows you to specify a client function that should be executed after the server round-trip completed successfully.

The PerformCallback method posts back to the server using the callback technology, and generates a server-side BootstrapCallbackPanel.Callback event. The method’s parameter argument is passed to the BootstrapCallbackPanel.Callback event’s handler as the CallbackEventArgsBase.Parameter property. So, the necessary server-side actions can be performed in the event’s handler, based upon the values of the arguments which can be obtained by parsing the passed information string.

Note that the necessary actions can be additionally performed on the client side before and after callback processing by using the BootstrapClientCallbackPanel.BeginCallback and BootstrapClientCallbackPanel.EndCallback client event.

Example

This example demonstrates the basic functionality of the Callback Panel.

  • Initialize a new instance of the BootstrapCallbackPanel class.
  • Add required controls to the ContentCollection array.
  • Use the client BootstrapClientCallbackPanel.PerformCallback method to initiate a callback. Handle the BootstrapCallbackPanel.Callback event to process a callback on the server side.

The image below shows the result:

csharp
protected void CallbackPanel_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e) {
    if(!string.IsNullOrEmpty(e.Parameter))
        passedInfo.InnerText = "Passed information: \"" + e.Parameter + "\"";
}
javascript
function onUpdateClick(s, e) {
    callbackPanel.PerformCallback("caused on the button click");
}
aspx
<dx:BootstrapCallbackPanel runat="server" ClientInstanceName="callbackPanel" OnCallback="CallbackPanel_Callback">
    <ContentCollection>
        <dx:ContentControl>
            <div class="card">
                <div class="card-body">
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sem lorem, rutrum at tincidunt aliquam, vulputate sit amet tellus. In hac habitasse platea dictumst. Morbi in dui a massa volutpat tristique. Aenean ultrices, elit ac commodo vestibulum, nisl neque pharetra est, id egestas neque leo dignissim augue. Vestibulum sodales metus at est maximus dictum. Quisque cursus felis id nisi auctor, volutpat imperdiet neque feugiat. Sed aliquet elit sem, ut vulputate lectus ultricies sit amet.</p>
                    <p><span class="badge badge-info"><%= IsCallback ? "The content was updated at " + DateTime.Now.ToLongTimeString() : "" %></span></p>
                    <small runat="server" id="passedInfo"></small>
                </div>
            </div>
        </dx:ContentControl>
    </ContentCollection>
</dx:BootstrapCallbackPanel>
<dx:BootstrapButton Text="Update" AutoPostBack="false" UseSubmitBehavior="false" runat="server">
    <ClientSideEvents Click="onUpdateClick" />
</dx:BootstrapButton>

See Also

Callback

BeginCallback

EndCallback

Callback Panel

BootstrapClientCallbackPanel Class

BootstrapClientCallbackPanel Members