How To Enable/disable Controls Against A User's Permission Via Type Casting
Jun 2, 2010
I want to enable/disable controls of a asp.net page against a logged in user's permission. say 'admin' & 'hr' can change user's birth date text-box in a page but others will see the text-box as disabled.
I have table called ROLE with fields (id,name,permission) example values (1001,madhu,hr)
I have another table called LOGIN with fields(id,DOB,password) example values(1001,24101989,madhukumar)
What i want is , if i login using the LOGIN table ,it check the id and permission in the ROLE table , if the permission is 'hr' it enable to access the menu , or if the permission is any other it just print the error message ("no permission")
Note: menu is placed in master page , but login is not in the master page ...
I'm trying to allow logged user who are in department XYZ to perform some task for my third party App. I have two SQL tables named Users & UserList. The third party app (GoldMine) graps the USERNAME from the Users table and store it as UserID which I then referecnce SessionID. The UserList table has two columns (GM_UserName & Department) which I'm interested in. When a user login into the 3rd party app (GoldMine), i then compare the USERNAME (from Users table) to GM_UserName (from UserList table) and see whether GM_UserName is in = 'Dept XYZ'. Take a look at the SQL query below.
sqlDept = "SELECT USERNAME FROM Users LEFT JOIN UserList ON UserList.GM_UserName=Users.UserName WHERE UserList.Department ='Dept XYZ'"
I'm able to do this.
If Session("Userid") = "TestUser1" Or Session("UserID") = "TestUser2" Then Do this Else Do that End If BUT unable to do this... If user's Department = 'Department XYZ' Then Do This Else Do that End IF
I have a user control in my Master page and need to be able to Enable/Disable it from ANY page. How is this done? My user control has a few TextBox fields and a button. I was hoping to set a public property and simply Enable/Disable, but public properties seem to only work on the Master page code behind and not other pages.
I am looking to enable/disable controls (TextBox, DropDownList, etc.) in a GridViews template column based on the users specific access level when the user clicks the edit button. I have tried the following two methods:
iam using masterpage and sitemap in my project, what i want to is that if user login is did, based on the user previlage in need to show the sitemap menu page if user i have the previlage to see the page then i should enable that page otherwise i need disable that page
I'm trying to enable/disable buttons in my gridview according to a value in gridview's field. But everytime when I try to run my page, it shows me below underlined error and point to my gvTimeSheet.DataBind() in page_load.
"Unable to cast object of type 'System.EventArgs' to type 'System.Web.UI.WebControls.GridViewRowEventArgs'." I also tried to enable / disable button in HTML but it just against from what I need it to be.
Example, sheet_status = true, I do not need to enable the button.
I have a gridview that is built based on my objectdatasource.. so at the moment, i have 1 gridview linked to 3 different objectdatasource resultsets.. my question is.. only 1 of the 3 do i want to allow or should i say enable the "GridView1_SelectedIndexChanged" ability. Is that possible, that when i bind the datasource to the gridview for that one, i can enable that?
I want a solution for checkbox Check changed.in my gridview when i check on any row it hits check changed event and i have made a button visible if atleast one checkbox is checked.(But when i uncheck i want the button to get hidden if no row is selected).
AM having a datalist with fields repeating based on some conditions say some textbox to enter Name ,DOB,Occupation,cell no,etc..and we have a button "Accompanying Person" .When this clicked i have to show same controls and enter details of accompanying persons like name,cell no etc...
SO same controls i have to show multiple times...but based on member /accompanying person i am hiding id field..but required field validator showing when the id is hidden..since this id is inside datalist and id textbox will be different how to hide this required field validator