how to create Back button in ASP.API (SDK)

Hello,

I have a cancel button here defined in my search page : this.CancelMethod =""; When i press this button i would like to to simply go back one page. How can i do that? Thanks.

  • 0

    Hi,

    From your above post it seems that you want to go back to previous page after clicking on Cancel button. To achieve this you can follow below steps.

    1. Create a method which will be assigned to the CancelMethod parameter.
    For e.g. this.CancelMethod =”MyCancelMethod;
    2. In MyCancelMethod method, write below code which will redirect the page to previous page.
    string strCancelURL = Url("521");
    Dispatch.Redirect(strCancelURL);
    3. If you want to redirect to specific summary page then write the action of that page in “Url” method instead of “521”.

    Hope this helps!

    Regards,
    Dinesh

  • 0

    I added this method to my page as suggested. Below is the code :

    public myEntityNew()

    : base("Entity", "air_entityid", "EntityNewEntry")

    {

    this.CancelMethod = "MyCancelMethod";

    }

    public void MyCancelMethod()

    {

    string myUrl = Url("521");

    Dispatch.Redirect(myUrl);

    }

    That didnt work for me. It says :

    Method not found in dll (C:\Program Files (x86)\Sage\CRM\CRM\CustomDotNet\EntityExpansion.dll) MyCancelMethod

    So i tried to include it in my AppFactory class. See below:

    namespace EntityExpansion

    {

    public static class AppFactory

    {

    //// Custom scripts

    //public static void MyCancelMethod()

    //{

    // DataPageNew newPage;

    // string myUrl = newPage.Url("521");

    // Dispatch.Redirect(myUrl);

    //}

    }

    }

    if i include the code in my appFactory class then i cant access the Dispatcher. What am i doing wrong?

  • 0

    Michael

    this.CancelMethod = "MyCancelMethod";

    This is referring to a method exposed in the appFactory class. Have a look at the URL that is generated for the cancel button.

  • 0

    Thanks for the info Jeff.

    The only problem i have is that i cant reach Dispatch method from within appFactory class (could you please tell me how to do it?).

    This line of code is not recognized . It could be if i could use sage utility namespace but then i cant access Redirect method.

    Dispatch.Redirect(myUrl);

  • 0

    You can either create a new class that just redirects and call the class from the appFactory.

    Or add your own 'continue' button.