Ticket Q418265
Visible to All Users

How to execute some action from the client side in XAF Web application

created 13 years ago

Hi! I want to do some functionality in my ASP XAF project. It is should be some javascript code on client side which will connect though ajax to the server and check if new objects is added to some table and display a blinking icon to a user. How to do that?

Answers

created 13 years ago (modified 13 years ago)

Hi Aibol,
You can use the following approach to redirect to an XAF view by clicking on a client-side image (this code was tested on MainDemo):

C#
public class CallbackHandler : IXafCallbackHandler { #region IXafCallbackHandler Members public void ProcessAction(string parameter) { WebApplication application = WebApplication.Instance; IObjectSpace objectSpace = application.CreateObjectSpace(); DemoTask obj = objectSpace.FindObject<DemoTask>(new BinaryOperator("Subject", "Review reports", BinaryOperatorType.Equal)); DetailView view = application.CreateDetailView(objectSpace, obj); WebApplication.Redirect(application.RequestManager.GetQueryString(view.CreateShortcut())); } #endregion } public partial class DefaultVertical : BaseXafPage { protected void Page_Load(object sender, EventArgs e) { CallbackManager.RegisterHandler("Redirect to task detail view", new CallbackHandler()); ASPxImage image = new ASPxImage(); image.ClientSideEvents.Click = string.Format("function(s, e){{ {0}; }}", CallbackManager.GetScript("Redirect to task detail view", "")); Controls.Add(image); ....................... } }

Please let us know if you need an additional assistance.

    created 13 years ago (modified 13 years ago)

    Hello Aibol,
    I believe it is possible to accomplish this task.
    Since this is not specific to XAF, you can use any solution you would use to achieve the same goal in a regular non-XAF ASP.NET application. If you experience difficulties integrating this solution in XAF, please let us know. We will be glad to assist you further.
    PS.
    If you need to register client scripts in XAF, check out the 3rd point of the eXpressApp Framework 11.2 ASP.NET Application Migration Guidelines KB Article.

      Comments (1)
      AI AI
      Anell Ibragimova 13 years ago

        Ok, i done this with my custom coding (AJAX + JQUERY). Now i need to redirect user to some form by clicking on that icon. How i should generate that link?

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.