tags:

views:

19

answers:

0

Hello All i am doing project in ASP .Net MVC 1.0.I want to display tabpanel based upon permission.i.e. i have written function which will return boolean value and based upon that value i want to display tab panel on my view page. Following is the function.Here i am passing tabName="UserBrowseTab" as my Database have entry for this only tab

      public static bool checkPermissions(int UserId,string tabName,string ModuleName)
    {
        bool bIsPermissonPresent = false;
        User objUser = userId.User(UserId, 1);

        Collection<Permissions> collPermission = objUser.GetPermissions(ModuleName);

        foreach (Permissions permission in collPermission)
        {
            if (permission.PermissionName == tabName)
            {
                bIsPermissonPresent = true;
            }

        }


        return bIsPermissonPresent;
    }

after this what i am doing is i am calling this function from viwepage as follows

        <%if(Utilities.checkPermissions(1, "UserBrowseTab", "UserManagement") == 
                    true)
                  { %>
                  <asp:TabPanel runat="server" HeaderText="Browse" ID="tabBrowse" 
                    Enabled="true">
                    <ContentTemplate>
                </ContentTemplate>
            </asp:TabPanel>
            <%}if(Utilities.checkPermissions(1, "UserGeneralInfoTab", "UserManagement") 
               == true)
                  { %>
             <asp:TabPanel runat="server" HeaderText="GeneralInfo" ID="tabGeneralInfo" Enabled="true">
            </asp:TabPanel>
            <%}%>

but here both condition's get satisfy and both tabs are displayed on view page