Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Can i completely hide the nav tool? ::

                                    -------

                                    I can greatly simplify my life if i could see code that will, upon successful login, check roles and if within a specific role, completely hide the entire nav tool. This will leave the default ListView for this role, which is perfect for me at this time.

                                    It will *greatly* enhance a demo i have slated for later today, in a huge manner, so if possible, i would luv this tidbit of knowledge as soon as is fairly possible ;))

                                    drew..

                                    ps: i sparingly use the Priority setting, but in this case, it is (to me) justified .. thank you for understanding. The issue lies with the complexity in understanding how xaf is deciding to show objects via Role permissions. I see no rhyme nor reason behind getting it to work right now. (old deny model)

                                0

                                Hi Drew,

                                Please accept our apologies for the delay in responding. We couldn't find an immediate answer or resolution. Please bear with us. We will inform you as soon as an answer is found.

                                Thanks,
                                Michael.

                                0

                                Thanks, why is this not showing up on my My Questions and Issues?

                                0

                                i just realized your side is caching the last page i was on, which is a bit crazy, doubly-so given your choice if highlighting colors is horrible for most color-challenged males. Frankly, my eyes cannot see the highlighted number in the page tool at the bottom.

                                Why remember the last page i was last on is being remembered on a whole new instance of the browser being brought up..?

                                0

                                Hello,

                                By default, you cannot completely hide the entire navigation control using security permissions. They work only for individual navigation items if they correspond to business objects.
                                However, the XAF security model allows you to implement your own custom permission and then handle it as required in a controller. Technically, you can use the SecuritySystem.IsGranted method to check whether a role has a certain permission and then execute the code that will hide the entire navigation control. You can learn more on how to access the navigation control from a controller at http://documentation.devexpress.com/#Xaf/CustomDocument2617
                                I hope this helps.

                                Thanks,
                                Dennis

                                0

                                ..is there (i am guessing not) a platform-agnostic approach we can discuss? That link directs to a win-based approach. I would prefer the agnostic but if pressed need a Web answer.

                                I thought this would be simple. After login, simply run a check for a user's roles. With the proper criterion met, simply grab a reference to the main window template, find the navbar, set its' visible to false. I scoured the SC yesterday but missed anything relevant. I was under time constraints for yet another demo on this particular project.

                                A bit of history to the request now that i have bit more time: it seems almost impossible to manage a security role to hide all but required BOs, when the main BO has associations in a very complex datamodel. I tried so many permutations but NEVER got just the BO showing i wanted. I wanted to hide all but the one. I ended up with everything showing, sometimes a subset that showed no discernible pattern, and most of the time i saw NO items in the navbar. I just gave up but will explore the new security model to see if i can make it happen.

                                Just offered this as food for thought.. drew..

                                0

                                Hi Drew,

                                I am afraid we do not have a platform-agnostic solution. In a Web XAF application, to accomplish your task, you can customize the Default.aspx template as follows:

                                	
                                [C#]
                                public partial class Default : BaseXafPage { protected void Page_Load(object sender, EventArgs e) { ... NTAC.Visible = IsNavigationAllowed(); } private bool IsNavigationAllowed() { if (!SecuritySystem.IsAuthenticated) return false; if (SecuritySystem.CurrentUser is ISecurityUserWithRoles) { foreach (ISecurityRole role in ((ISecurityUserWithRoles)SecuritySystem.CurrentUser).Roles) { if (role.Name == "Administrators") return true; } } return false; } ... }

                                Thanks,
                                Michael.

                                0

                                i reduced this down to

                                return (SecuritySystem.CurrentUserName=="admin")?true:false;

                                as i think the original was geared to the new security system, which i am not yet using.

                                As well, can you advise exactly which name is required to hide the entire navbar, including the splitter? It seems (i think), based on css styling names, that i have to hide "MT" but this is standard html and not asp-based so i am not able to use MT.Visible= .. etc. thank you kind folks.

                                0

                                Hi Drew,

                                To control an HTML element from code, add the runat="server" attribute to it. However, I do not understand what else you need to hide. The "MT" table contains all other page controls, and if you hide it, some scripts won't work.

                                Thanks,
                                Michael.

                                0

                                The splitter bar and the original size of the navbar remain when the hiding is enacted. I would like those gone.

                                0

                                Hi Drew,

                                If you mean the pane with the Diagnostic and Tools action containers on the left side of the page, you can hide it along with the splitter by setting the isLeftPanelVisible variable in the CurrentRequestWindow_PagePreRender method to "false" (in Default.aspx). If you are using a custom template, the code may vary.

                                Thanks,
                                Michael.

                                0

                                just to be clear, to save me yet more tinkering time, you refer to Default.aspx, but the splitter is in DefaultVertical.aspx. Are the instructions pertinent to the vertical template as well?

                                0

                                ok, clearly i am not an asp.net guru, that is why i use XAF.. can i simply have clear explicit instructions on how to hide the entire navigation area? I would like to do it directly in page_load as the other methods in pre-renders that i found in B222054 allow the navbar to show for a brief period, which is not correct. I can simply grab a true/false from the security check, this is not an issue.

                                At issue is the labyrinth that is Default & DefaultVertical. To repeat: i would like an easy way to remove ALL evidence of the navigation system, including the splitter bar, completely, for non-admin users. The nav logic should also allow for the fact that is NO nav items are showing then the splitter should also go away, this is only logical.

                                We can do soooo much with xaf, why is it that these seeming simple tasks are so time-consuming unless we are already gifted in the low-level coding arena? ;) thanks kindly, drew..

                                0

                                Hi Drew,

                                Your requirements are quite unusual. That's why this scenario is not supported out-of-the-box. To hide the navigation pane in the DefaultVertical.aspx template, modify the page markup by adding the runat="server" attribute to the MRC table and add the following code to the Page_Load method:

                                	
                                [C#]
                                bool navBarVisible = ... MRC.Rows[0].Cells[0].Visible = navBarVisible; MRC.Rows[0].Cells[1].Visible = navBarVisible;

                                Additionally, modify the OnLoadCore method in the TemplateScripts.js file:

                                	
                                [JScript]
                                function OnLoadCore(panelId, separatorCellId, separtorImageId, display, collapseLeft) { tableCellDefaultDisplay = isIE7 ? "block" : "table-cell"; var LPcell = document.getElementById(panelId); var separatorCell = document.getElementById(separatorCellId); if (LPcell == null || separatorCell == null) return; // <--- NEW LINE LPcell.style.display = display ? tableCellDefaultDisplay : 'none'; separatorCell.style.display = LPcell.style.display; var leftPanelDisplay = _aspxGetCookie(panelId + postfix); if (leftPanelDisplay && separatorCell.style.display != 'none') { LPcell.style.display = leftPanelDisplay; } UpdateSeparatorsImages(separtorImageId, collapseLeft, leftPanelDisplay); AdjustSize(); DXattachEventToElement(window, "resize", AdjustSize); }

                                Thanks,
                                Michael.

                                0

                                THANK YOU Michael.. Now *that* was a thing of beauty. This will now make a proof-of-concept app so much better. There are often times when we have roles that are very limited that have NO rights to see more than one screen and this is perfect. I see a combination of a switchboard and a navbar-hiding sequence where certain roles go to certain screens. This is LOVELY. thank you. And thank you for your patience with my persistence.

                                drew..

                                0

                                Sorry to beat a dead horse here, but.. Somehow this has caused the entire splitter, *except* the button to close or move the splitter itself, to disappear. It is empty except the button. I have text diff'd my DefaultVertical.aspx file and there is nothing to account for this. I even commented out the additional line to the js template and found there to be NO change on the actions of the act this entire issue was focused on.

                                I reset my browser, emptied the cache, everything, no change. This has been happening since the change..

                                Any thoughts?

                                0

                                Hi Drew,

                                Thank you for the report. It seems that ASP.NET does not support code blocks within server-based markup elements (see http://stackoverflow.com/questions/4864138/code-blocks-are-not-supported-in-this-context-in-asp-net-control). So, the style we applied to a table cell in our template is not properly set. To workaround this limitation, add the following method:

                                	
                                [C#]
                                protected void Page_PreInit(object sender, EventArgs e) { MRC.Rows[0].Cells[1].Attributes["class"] = "dxsplVSeparator_" + Theme + " dxsplPane_" + Theme; }

                                Thanks,
                                Michael.

                                0

                                thank you! Your (SC) ability to understand the nuances of asp.net etc sometimes astounds me. WHy i am very good at interfacing with clients to allow for true business requirements to emerge, i do suck at the inner workings of asp.net. so.. thank you!

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners