Current filter:
                                You should refresh the page.

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,
                                 
                                Consider the following implementation plan:

                                1. Continue with your MultiCompanyLogonController class, but inherit from ViewController instead. Remove the CreateLogonController method from TestAspNetApplication.
                                This will remove the Cancel button.
                                2. Use SimpleAction instead of PopupWindowShowAction and handle its Execute event handler to implement your logic. In the event handler, use the How to: Access Objects Selected in the Current View approach to access the current logon parameters object and modify its GridTrueCode property as you wish.
                                3. Handle the CreateCustomLogonWindowControllers event and create your MultiCompanyLogonController class as described at Logon Form Controllers and Actions. Note that the CreateController method must be used for MultiCompanyLogonController and SetApplicationSpecificThemeWebController. Remove the creation of ObjectMethodActionsViewController in the CreateCustomLogonWindowControllers event handler - you do not need it with your MultiCompanyLogonController.
                                4. Support change notifications for your GridTrueCode property as per PropertyChanged Event in Business Classes - it is important for immediate updates of your property in the UI after your logic at step #2.
                                5. If I understand you correctly, the GridTrueCode property will be represented by a custom PropertyEditor or ViewItem in the UI. For more information about how to create and customize custom View Items, see the following:
                                Ways to Access UI Elements and Their Controls | View Items.
                                • Customer78262 08.16.2019

                                  Hi Dennis,

                                  I don't want to remove Cancel nor Log on button.

                                  Trying to Achieve : I have a runningXaf application which is huge and not written by me. My goal is simply to display an Image in addition to my Login Page. Since it's not written by me I would like to keep it as similar as possible and avoid changing the controllers itself .

                                  Solution1: To achieve it I added asp:Image to my Login.aspx

                                  [C#]
                                  <%@ Page Language="C#" AutoEventWireup="true" Inherits="LoginPage" CodeBehind="Login.aspx.cs" %> <%@ Register Assembly="DevExpress.ExpressApp.Web.v14.1" Namespace="DevExpress.ExpressApp.Web.Templates.ActionContainers" TagPrefix="cc2" %> <%@ Register Assembly="DevExpress.ExpressApp.Web.v14.1" Namespace="DevExpress.ExpressApp.Web.Templates.Controls" TagPrefix="tc" %> <%@ Register Assembly="DevExpress.ExpressApp.Web.v14.1" Namespace="DevExpress.ExpressApp.Web.Controls" TagPrefix="cc4" %> <%@ Register Assembly="DevExpress.ExpressApp.Web.v14.1" Namespace="DevExpress.ExpressApp.Web.Templates" TagPrefix="cc3" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Logon</title> </head> <body class="Dialog"> <div id="PageContent" class="PageContent DialogPageContent"> <form id="form1" runat="server"> <cc4:ASPxProgressControl ID="ProgressControl" runat="server" /> <div id="Content" runat="server" /> <center> <asp:Image id="GridImageToDisplay" runat="server" alt="" src="%20" visible="false" /> </center> </form> </div> </body> </html>

                                  Then provided Image src in Login.aspx.cs in Page_Load function

                                  [C#]
                                  public partial class LoginPage : BaseXafPage { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) GridImageToDisplay.Src = Test.Module.Impl.GridTrue.generateGridTrueImageCode(); } public override System.Web.UI.Control InnerContentPlaceHolder { get { return Content; } } }

                                  This Solution was almost working fine except one point. Login Page is loaded twice and postback is always true hence Page_Load is loaded again and again that generate gridCode again but doesnot update the picture on LoginPage.
                                  So the Image Code on Login Page is different which gives later error in matching GridCode pattern.

                                  I could not find any solution to get rid of this issue.

                                  Solution2:  Then I thought of creating asp:button and generate gridcode only when button clicked. This solution is also working fine. Only my Login Page was not as pretty and buttons were not in symmetry.

                                  Solution3: Now I am trying to implement either solution1 or solution2 in Xaf itself.
                                  Based on Gosha's suggestions I hardly succeed in creating another GenerateButton but according to your suggestion I have to change it again.

                                  To be honest, I am very confused now what is the right way to achieve it.

                                  Obviously to have this functionality work in XAF would be the best solution.
                                  Is it possible to display an Image (Solution1) directly through my customized class as we created new fields.

                                  [C#]
                                  [NonPersistent] public class CompanyLogonParameters : AuthenticationStandardLogonParameters, IApplicationCompanyParameter { #region Fields private string savedPassword; private string gridTrueCode; //added #endregion #region Public Properties //public string GridImage { // set { this.gridImage = GridTrue.generateGridTrueImageCode(); } // get { return this.gridImage; } //} /** added...*/ public string GridTrueCode { get { return this.gridTrueCode; } set { this.gridTrueCode = value; this.savedgridTrueCode = value; } } [ImmediatePostData(true)] public new string UserName { get { return base.UserName; } set { base.UserName = value; } } public new string Password { get { return base.Password; } set { base.Password = value; this.savedPassword = value; } } [VisibleInListView(false)] [VisibleInDetailView(false)] [VisibleInLookupListView(false)] public string SavedPassword { get { return this.savedPassword; } } // display base 64 string as Image from here as we create new button ?????????? [Action(Caption = "Generate Grid")] public void GenerateGrid() { } #endregion } }

                                  Ifnot can we somehow make Solution1 to work, if also not I will continue to follow suggestion from Gosha.
                                  I have already new Button but I don't want to delete Cancel or Logon Button.
                                  If I change MultiCompanyLogonController : LogonController as your suggestion to  MultiCompanyLogonController : ViewController thenmy Accept function for Logon button defined in it doesnot work.

                                  How should I proceed ?

                                • Dennis (DevExpress) 08.20.2019

                                  Hello,

                                  Please pardon my delayed response.
                                  Solutions 1-2: XAF Web UI creates controls and performs any other updates using callbacks. Your first approach with standard controls will not work due to the reasons explained in The Concept of Callbacks. Your second approach with a standalone button does not look good either, because this button is external to the logon parameters DetailView - I would not recommend it even if you find a way to style it well.

                                  The solution path I suggested is the most natural for XAF development flow:

                                  1. Define your data model properties and logic (WebCompanyLogonParameters). This data model is to be used to render the UI: Data Types Supported by built-in Editors.
                                  2. Customize the auto-generated UI using attributes, Controllers or custom Property Editors if you want anything behind built-in editors for your data model types.

                                  I checked the files you attached and they do not contain the changes I suggested (1-5) - please follow my instructions above and let me know in case of any difficulties. I must emphasize that XAF does not provide the Cancel Action at the logon form. Yours comes as part of LogonController inheritance and its behavior is undetermined. Rather than fighting with it, I suggest you remove this Cancel Action using the ViewController inheritance. It will leave the Login Action untouched.
                                  As for the overridden Accept method, you can implement the same logic in at least 2 good places:

                                  1. In the XafApplication.LoggingOn event handler or the overridden OnLoggingOn method of your TestAspNetApplication class.
                                  2. In your MultiCompanyLogonController or another controller where you can access the standard LogonController class and its Actions, events as described at Customize Controllers and Actions. Again, it is important to follow point #3 of my previous answer to register this custom Controller on the logon form.

                                  Thanks,
                                  Dennis

                                  P.S.
                                  [VisibleInListView(false)], [VisibleInDetailView(false)] and [VisibleInLookupListView(false)] attributes on properties of WebCompanyLogonParameters serve no purpose (this non-persistent class is not used in lookup editors) and complicate code reading - I suggest you remove them.