ASPxWebControl.RedirectOnCallback(String) Method
Redirects a client to a new URL while processing a callback.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v18.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
url | String | A string value specifying the new target location. |
Remarks
While a callback is being processed on the server, the RedirectOnCallback method enables you to redirect the application to another web resource.
Example
This example demonstrates how to use the ASPxWebControl.RedirectOnCallback method to redirect a user on an AJAX request, for example, ASPxCallbackPanel control callback. With this method, you can implement user login with asynchronous behavior (Login Control will reload the page even if the validation fails or redirect the user on successful validation, but in this example, the login process is done asynchronously).
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-redirect-user-on-callback-t228312
<head runat="server">
<title>How to redirect user on callback</title>
<script>
function ProcessLoginCallback() {
CallbackPanel.PerformCallback();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<dx:ASPxCallbackPanel ID="CallbackPanel" ClientInstanceName="CallbackPanel" runat="server" Width="200px" OnCallback="CallbackPanel_Callback">
<PanelCollection>
<dx:PanelContent>
<dx:ASPxValidationSummary ID="ValidationSummary" runat="server"></dx:ASPxValidationSummary>
<dx:ASPxLabel ID="LoginLabel" runat="server" Text="Email:"></dx:ASPxLabel>
<dx:ASPxTextBox ID="LoginTextBox" runat="server" Width="170px">
<ValidationSettings>
<RequiredField IsRequired="true" ErrorText="Enter Email" />
<RegularExpression
ValidationExpression="^[-a-z0-9!#$%&'*+/=?^_`{|}~]+(?:\.[-a-z0-9!#$%&'*+/=?^_`{|}~]+)*@(?:[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?\.)*(?:aero|arpa|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|[a-z][a-z])$"
ErrorText="Bad email address" />
</ValidationSettings>
</dx:ASPxTextBox>
<dx:ASPxLabel ID="PasswordLabel" runat="server" Text="Password"></dx:ASPxLabel>
<dx:ASPxTextBox ID="PasswordTextBox" runat="server" Password="true" Width="170px">
<ValidationSettings>
<RequiredField IsRequired="true" ErrorText="Password is Required" />
</ValidationSettings>
</dx:ASPxTextBox>
<br />
<dx:ASPxButton ID="Button" runat="server" Text="Login" AutoPostBack="false">
<ClientSideEvents Click="ProcessLoginCallback" />
</dx:ASPxButton>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxCallbackPanel>
</form>
</body>
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RedirectOnCallback(String) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.