Ticket T464375
Visible to All Users

How to open the current View in a new web browser tab using a custom Action when EnableMultipleBrowserTabsSupport = True

created 8 years ago (modified 8 years ago)

Congrats, you have done the hard work implementing this feature but I can't tell my users that the amazing improvement of this version is that they are now able to copy and paste the url. So, how could I achieve implementing an action that finally open a view (current or another) into a new browser tab?

Answers approved by DevExpress Support

created 8 years ago (modified 8 years ago)

Hello José,

>>So, how could I achieve implementing an action that finally open a view (current or another) into a new browser tab?
Even though we do not currently provide good solutions for this particular task, our team will keep your request in mind regarding future updates of our framework.

UPDATED:
To duplicate the current View in a new browser tab using an Action, consider one of the two approaches below:

C#
using System.Web; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Actions; using DevExpress.ExpressApp.Web; using DevExpress.Persistent.Base; namespace MainDemo.Module.Web { public partial class T464375 : ViewController { public T464375() { var duplicateCurrentViewAction = new SimpleAction(this, "DuplicateViewInBrowser", PredefinedCategory.Unspecified); //Approach #1. The most simple and straightforward way using client-side API. //1.1. Opens a View in the main form template with navigation, logo, etc. duplicateCurrentViewAction.SetClientScript("window.open(window.location.href,'_blank');", false); //1.2. Opens a View in the dialog form template. //duplicateCurrentViewAction.SetClientScript(string.Format("window.open('{0}'+ window.location.hash, '_blank');", WebApplication.PopupWindowTemplatePage), false); //Approach #2. Using the server-side API (e.g., when you have SingleChoiceAction and cannot use the 1st approach). //duplicateCurrentViewAction.Execute += (s, e) => { // string fullViewURL = string.Format("{0}#{1}", HttpContext.Current.Request.Url.AbsoluteUri, ((WebApplication)Application).RequestManager.GetQueryString(View.CreateShortcut())); // WebWindow.CurrentRequestWindow.RegisterStartupScript(duplicateCurrentViewAction.Id, string.Format("window.open('{0}','_blank');", fullViewURL)); //}; } } }

I have also blogged about this feature to collect more user feedback: http://dennisgaravsky.blogspot.com/2017/01/follow-up-on-enablemultiplebrowsertabss.html

See Also:
How to add a hyperlink to a new object to a standard aspx page

    Show previous comments (8)
    Dennis Garavsky (DevExpress) 8 years ago

      @JAMEL HABIB:
      I've created a separate ticket on your behalf (T471084: How to show the opened detail view without navigation pane and others in a new web browser tab). It has been placed in our processing queue and will be answered shortly.

        Hi José Enrique :
        can you tell me which event are you using these code?
        thanks!

        C#
        DevExpress.ExpressApp.Web.WebApplication webApplication = (WebApplication)Application; DevExpress.ExpressApp.Web.IHttpRequestManager requestManager = webApplication.RequestManager; IObjectSpace os = Application.CreateObjectSpace(); DetailView detail = Application.CreateDetailView(os, Application.FindDetailViewId(e.CurrentObject.GetType()), true, os.GetObject(e.CurrentObject)); DevExpress.ExpressApp.ViewShortcut shortcut = detail.CreateShortcut(); string fullViewURL = string.Format("{0}#{1}", System.Web.HttpContext.Current.Request.Url.AbsoluteUri, requestManager.GetQueryString(shortcut)); WebWindow.CurrentRequestWindow.RegisterStartupScript("", "window.open('"+ fullViewURL + "','_blank');");
        Dennis Garavsky (DevExpress) 8 years ago

          @he dandan: In my answer above you can see that this code is used inside the Execute event handler of a custom Action.

          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.