Web Forms :: Dynamic Menus Not Being Refreshed Between Users?
Oct 18, 2010
I have an ASP.Net 3.5 application with a menu. The menu is set to an xmlDataSource. The xmlDataSource is given the menus for the user as a dataset. The xmlDataSource uses an xsl transform file.Here is the code behind:
[Code]....
My problem is, when another user logs into the system, he/she gets the previous user's menus. This is based on time somehow, because if you wait long enough after another user has left a page, you'll get the proper menus.Could it have something to do with page caching? Is there something I'm missing with menus?
I want to create dynamic link buttons in the asp.net code based on who logged in. For e.g. if the salespesron logged in , he should see "Customer List" and "Item Search" as menu options.
If customer logged in , it should be able to see "Customer Details" and "Item Search" as menu options.
I'm not sure how to create this dynamically in html code.
I try to serach and found the code below on this forum but it doesn't appears to create any dynamic button menu.
Ok, everyone knows that the z-index is messed up in IE8 and that requires patches or workarounds...
What I can't seem to find a solution to is the white background on the DynamicMenu parts of a Menu control. Setting the background color to transparent or not setting it all doesn't seem to have any effect. This is only a problem in IE8, Firefox 3.6.8 renders the dynamic menus without the white background.
Does anyone out there use ComponentOne's C1Menu and create a menu with subitems at runtime? I have went through their forums and help and anything at runtime is done with C1WebMenu which was replaced with this version.I need to create the whole menu with subitems. Can you show code for this if you have?
in one of my page i need to display the menus & sub menus dynamically,for this i have a menu table called colleges & one more table called branchs 1] ABC Science ArtsCommarce2] EFG mathszoology historylike thissome times the menus are 3some times they may be 4,5,6 may randommy incresesfor this i have the two table one is menu & sub-menus
I'm currently writing a web app in ASP.NET MVC 1.0 (although I do have MVC 2.0 installed on my PC, so I'm not exactly restricted to 1.0) -- I've started with the standard MVC project which has your basic "Welcome to ASP.NET MVC" and shows both the [Home] tab and [About] tab in the upper-right corner. Pretty standard, right? I've added 4 new Controller classes, let's call them "Astronomer", "Biologist", "Chemist", and "Physicist". Attached to each new controller class is the [Authorize] attribute. For example, for the BiologistController.cs
[Authorize(Roles = "Biologist,Admin")] public class BiologistController : Controller { public ActionResult Index() { return View(); } }
These [Authorize] tags naturally limit which user can access different controllers depending on Roles, but I want to dynamically build a Menu at the top of my website in the Site.Master Page based on the Roles the user is a part of. So for example, if "JoeUser" was a member of Roles "Astronomer" and "Physicist", the navigation menu would say:
[Home] [Astronomer] [Physicist] [About]
And naturally, it would not list links to "Biologist" or "Chemist" controller Index page. Or if "JohnAdmin" was a member of Role "Admin", links to all 4 controllers would show up in the navigation bar. Ok, you prolly get the idea... Now for the real question... Starting with the answer from this StackOverflow topic about Dynamic Menu building in ASP.NET, I'm trying to understand how I would fully implement this. (I'm a newbie and need a little more guidance, so please bare with me.) The answer proposes Extending the Controller class (call it "ExtController") and then have each new WhateverController inherit from ExtController.
My conclusion is that I would need to use Reflection in this ExtController Constructor to determine which Classes and Methods have [Authorize] attributes attached to them to determine the Roles. Then using a Static Dictionary, store the Roles and Controllers/Methods in key-value pairs. I imagine it something like this:
public class ExtController : Controller { protected static Dictionary<Type,List<string>> ControllerRolesDictionary; protected override void OnActionExecuted(ActionExecutedContext filterContext) { // build list of menu items based on user's permissions, and add it to ViewData IEnumerable<MenuItem> menu = BuildMenu(); ViewData["Menu"] = menu; } private IEnumerable<MenuItem> BuildMenu() { // Code to build a menu SomeRoleProvider rp = new SomeRoleProvider(); foreach (var role in rp.GetRolesForUser(HttpContext.User.Identity.Name)) { } } public ExtController() { // Use this.GetType() to determine if this Controller is already in the Dictionary if (!ControllerRolesDictionary.ContainsKey(this.GetType())) { // If not, use Reflection to add List of Roles to Dictionary // associating with Controller } } }
Is this doable? If so, how do I perform Reflection in the ExtController constructor to discover the [Authorize] attribute and related Roles (if any) ALSO! Feel free to go out-of-scope on this question and suggest an alternate way of solving this "Dynamic Site.Master Menu based on Roles" problem. I'm the first to admit that this may not be the best approach.
I am using two Updatepanels in ASP.NET AJAX and as soon as there is some event in first updatepanel, it will get refreshed at that time I want my second Updatepanel getting refreshed too. How can I do that ?
I have deployed my application in the test server, and did the settings correctly, but my websites pages are getting refreshed automatically in less than 2 mins.
I have tweaked some button colors on a webform after updating those pages on server where iis is.From my local machine i can see the updated colors of button.But in some of the other users machines they still see the old webform.even though they refresh there IE.but when they use firefox they can see the new changes.What is wrong with IE, even after deleting cache still it is showing old webform.
I am using the file upload control in my page i upload image .. path available in the file upload control after i selected the drop downlist for different action at that file upload control path refreshed.. wht shoul i do?
I have a Reportviewer control linked to Report1.rdlc with a matrix with Drillthrough activiated.When I click the "+" buttons to drill through, even I enclosed the control with Penal etc it still caused the whole page refreshed which is annoying. The same Panel code works well on other ASP.net controls on page on running.
I am using Standard control FileUpload asp.net to upload a simple file to server. When I select a file and submit, the page is refreshed to the file is uploaded to server. Then I using a UpdatePanel to perevent the refresh. But in this way the file is not uploaded and FileUploaded.HasFile property return false. What can I do?
I have created two user controls(Say uc1.ascx and uc2.ascx). I have wrapped second user control(uc2.ascx) as a DIV in first user control(uc1.ascx), to populate uc2.ascx as a JQUERY modal popup. I have created a Webpart(class file) where I specifed the first user control path. Now in an aspx page, I have added this webpart as a webpart zone. The syntax loks somethng like this.
In my first user control(uc1.ascx), I have gridview. Now when I clik on a button in a webpart, a JQuery modal popup comes where I fill the details and after saving the details, the popup closes. But the webpart is not refreshed due to which I am not able to get the updated data in the grid view.
How can I refresh a particular webpart when I have multiple webparts in the same page in order to get updated data?
I am trying to develop a web application. I got a free CSS template from the net that has tabs on it. I want to apply menu on each tab. Each menu has different set of sitemap structure.For example, in "Business" tab, I want to have the following sitemap structure:
I have created a page with a gridview in asp.net that displays the records of a database table and allows users to delete checked records by clicking on a delete button. After I delete a record and I try to refresh the page from the browser (I am using mozilla)I get the follow message:
"To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."
and if I click resend another record is deleted automatically. Even though I am reloading the gridview after the deletion the application executes again the onclick event of the delete button is executed and the gridview things that there is a checkedbox selected so the code executes my delete function again.
Is there any way to get rid of these behavior. I have been trying quit a few things but nothing works for me.