You must Sign In to post a response.
  • Category: ASP.Net MVC

    Make panel show/hide based on role admin from web.config page

    Hi ,

    I am using ExtJs page for designing.
    I used some panels in that page.
    I want to make this panel visible true or false from Web.Config page based on roles like "admin" and not from controller.

    Ext.create('Ext.form.Panel', {
    id: 'SampleId',
    margin: '0 0 5 0',
    bodyPadding: 5,
    width: 580,
    collapseFirst: false,
    collapsible: true,
    title: 'Sample',
    items: [
    {
    ...........
    }
    ]
    }
    )


    How can I do this?
    please guide me to make panel show/hide from web.config page based on role admin
  • #768673
    Hi,

    If admin logged in you want to display the panel and if normal users you want to hide it?

    You have not mentioned what technology you are using to implement this.
    If you are using MVC then you can use Global.asax page and gave a name/id to the panel. So it was admin entering we can validate him in this Global.asax because this is the first file to take by .net engine.

    If you using ASP/VB.NET use Page Load event and declare a session variable in the Web.Config file.
    You can also do it app.config file like below,


    <appSettings>
    <add key="MyBaseDir" value="C:\MyBase" />
    <add key="Dir1" value="C:\Dir1"/>
    <add key="Dir2" value="D:\Dir2"/>
    </appSettings>


    Inside the code we can call this values by following way,


    ConfigurationManager.AppSettings["Dir1"]

    Thanks,
    Mani


Sign In to post your comments