Using Roles To Show Data On The Database?
Jul 23, 2010May I ask your knowledge on how I will show the data on the database in gridview using roles?
Ex. I have a team leader roles, then only his team will show when he log-in.
May I ask your knowledge on how I will show the data on the database in gridview using roles?
Ex. I have a team leader roles, then only his team will show when he log-in.
I want to create the roles,membership and user data on ISeries AS 400 rather then the one used in APP_Data.
View 4 RepliesI would like to use the Role Membership and User Security database as my application database too. That is, just add the tables and relationships required by my application's data access layer to the Membership and Roles Database to save on hosting fees, (I have to pay extra for having two databases instead of one). Of course, the connection string would have to be adjusted, but I don't see a downside considering the application's database is actually an Access database. What can I say, it was a requirement at the time.
Basically, I would like to do the opposite of this:
http://forums.asp.net/p/1162485/1925262.aspx#1925262
I am getting user list using Membership.GetAllUsers() function. And I bind this data in a grid view.
But I cannot find the roles information here. I need to show the roles in that grid view.
I have a custom menu, which leverages the standard asp.net sitemap. It works well but some of my pages are dynamically generated by URL rewriter, so they don't sit in the sitemap XML file. At the moment I rolled a custom solution which shows/hides menu items via CSS class and a programmatic check of the role that the user is in. It works ok until I visit a dynamic page that doesn't exist in the sitemap file. I've tried the "roles" attribute in the sitemap file with security trimming but it isn't working because I have a custom menu.
Is there a way I could leverage the roles attribute in the sitemap file to show/hide menu items for my custom control below, even when some pages are not in the sitemap? My menu control is below...
<div class="menu">
<ul>
<asp:Repeater ID="rpt" runat="server" DataSourceID="smdsMenuPrimary"
EnableViewState="False">
<ItemTemplate>
<li class="<%#GetDisplayClass((SiteMapNode)Container.DataItem)%>"><a href='<%# ((SiteMapNode)Container.DataItem).Url %>'><%# ((SiteMapNode)Container.DataItem).Title %></a></li>
</ItemTemplate>
</asp:Repeater>
</ul>
i have datagrid , data coming from database but data in database as formated , i want to show data wihotu format
below example:
<B> test </B> data base has this type data
but in grid i want to show test not with format,
i am getting same data from database.
I have a database and i what to pull different columns from a row without having to but it in a datagrid. I know this is 1st grade stuff. :)
View 5 RepliesI am newbie to asp.net.I want to create roles for the existing users in my database. I dont want to use the membership provider database n roles provided with it.(i don't want to use aspnet.mdf at all)
I am create roles for my existing users n assign i wanted to assign the particular roles to a particular assign.
i want to implement role_based autherization in an application, the only way i know to do it is to use roles framework, but i don't want to add any extra tables to my database, my database already have a users table with a column that specifies a role for each user
how can i use this framework without adding the tables it requires to my database?
We have a web application using VS 2008, c#. We try to filter siteMap nodes based on security roles. We have our customized the mether GetRolesForUser() in RoleProvider class to determine a user's role. In this method, roles will be returned by querying an SQL Server database. However, we found that each time a page was loaded/refershed, this GetRolesForUser() was called, and the database would be queried. This is too MUCH and expensive. We thought the roles should be queried only once when a user logs in. After that, role info should be stored somewhere for this user, rather than query DB all the time.
View 3 RepliesI'm developing a system where we want to restrict the availability of information displayed to users based on their roles.
e.g. I have a tabled called EventType (ID, EventTypeDescription) which contains the following records:
1, 'Basic Event'
2, 'Intermediate Event'
3, 'Admin Event'
What I need to achieve is to filter the records returned based on the username (and hence role) of the logged-in user. e.g if an advanced user is logged in they will see all the event types, if the standard user is logged in they will only see the basic event type etc.
Ideally id like to do this in a way which can be easily extended to other tables as necessary. So I'd like to avoid simply adding a 'Roles' field to each table where the data is user context sensitive.
One idea I'm thinking of is to create some kind of permissions table like:
PermissionsTable
(
ID,
Aspnet_RoleId,
TableName,
PrimaryKeyValue
)
this has the drawback of using this is obviously having to use the table name to switch which table to join onto.
Edit: In the absence of any better suggestions, I'm going to go with the last idea I mentioned, but instead of having a TableName field, I'm going to normalise the TableName out to it's own table as follows:
TableNames
(
ID,
TableName
)
[Code]....
Let's say I have a rolegroup as follows:
<asp:LoginView ID="lvDoSomeStuff" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="RoleOne,RoleTwo">
<ContentTemplate>
...
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
Is there a way I can make it so that a user must meet RoleOne and RoleTwo to satisfy the RoleGroup? By default, if a user is in either of the two roles, they will be granted access. I know I can do this via the code-behind, but I'd prefer to be able to wrap some content template with this markup instead of having to wrap it in a panel and hide the panel programmatically.
I have a dropdown box showing a list of roles. I used Roles.GetAllroles() for showing all roles in the dropdown box but I don't want to show a role named "Admin" in the dropdown box. How can I keep it out?
View 2 RepliesI am creating a Web Application in asp.net 2.0 and sql server 2005.I want to use an existing database.
I have created a login and a signup page. Then i replace the new SQL database (the one that is created automaticly by the visual studio) with the exiting database I have.If I create a new user, the new user goes to the database and I can login with the new user. I cannot login with the existing users.If I go to the asp.net configuration, I only can see the new users I have created, I cannot see the users that were in the database already and I can't see the roles also.
I can I make the new application to recognize the users and roles of the existing database?
I am working on an Ecommerce website. I have created a database using Server Explorer named 'MyTestStore' and created Tables and Stored procedures inside it.
Than I used the program called aspnet_regsql.exe (which is in:
C:windowsMicrosoft.NETFrameworkv2.0.50727) to create the membership and roles tables. And this tool created all the membership tables in the MyTestStore database. All is fine till this point.
Enabling Roles:
Now I need to enable roles, insert admin and users into this membership tables in my database. so I opened up ASP.Net Configuration Tool but when I enable and create roles it automatically creates a database called ASPNETDB under App_Data folder whereas, I want to have the roles enabled in the database MyTestStore. But it keeps creating the database ASPNETDB. How do Imap the ASP.Net configuration Tool to create and add users into my database called MyTestStore instead of that default ASPNETDB.
I have a datalist.what i want to do is to show my data from database as hyperlinks, and when i click on any of that link it redirects to other page. In that directed page i am getting the link text by "querystring". Every thing is working fine but the problem is that when i put the same datalist inside a tab container the "querystring" returns Null.
how can i get the hyperlink text??
[Code]....
i want to implement asp.net role provider to assign users over my LAN to roles and have my asp.net intranet app implement security based on roles.
i dont want to use VS to manage this with the built in tools but rather hand this off to users to manage themselves. i want an admin folder with a page(s) for admin roles to be able to create/edit roles and manage users in roles... this way an admin can add a domain user (MyDomainUsername) to a role such as ProojectManager or Tester or Developer... and users wont need to contact me for these tasks...
can anyone provide me a link (or some sample code) to some sample i can use to admin roles and users over a LAN in asp.net with c#?
I have a multi level application that I am developing and need to block multiple rows from being joined. I know how to hide one role but I cannot figure out how to hide multiple.
Here is my current code
[Code]....
I want set roles and views to my dataBase.
this three roles: FullAccess - BasicAccess - ReportingAccess
I don't know how I can set this three to my database for users access.(webapplication)
I'm using sqlserver 2008 and visual studio 2008.
I want to get data from the database and display it in gridview. The gridview should be editable. Meaning the user can add, edit and delete items/rows in the gridview. Everytime the user adds/updates/deletes an item, the gridview is also updated. However, these changes will only be saved to the database once the Save button is clicked.
View 3 RepliesI have insert.aspx page that users can enter data and when they click on insertbutton it insert data into database below is SP
create procedure [dbo].[InsertFreeState2]
@Name nvarchar(40)
,@mobile varchar(20)=null
,@Tell varchar(15)=null
,@Transfer nvarchar(20)
,@Type nvarchar(20)
,@id int =0
[code]....
here when users enter new mobile number it should insert data into database and show 'You have been registered' and if they enter Mobile number that was in table it shouldn't insert data into database and show=='You can just register 1 Time'
problem is when I enter new mobile number it inserted data into database but it showed this message'You can just register 1 Time' but here it should show 'You have been registered' I mean in both condition it show this message 'You can just register 1 Time'
it never show this message='You have been registered'
what should i do?
i have created tree view using asp.net web forms...it will simply show the data in database in the tree view. i hav kept label which should show the specific id of each parent and child when clicked for all parent nodes id is displayed as 0 and for all child nodes id is displayed as 1, it should come like this for eg,when the 1st parent is clicked it should display 1 and then it's when 1st child is licked label id should be 1a, 2nd as 1b and 3rd as 1c and so on... wat function should i use to display in the above way
View 2 Repliesusing .NET 2.0 want to format datagrid , i am using DataGrid. i am saving data from textbox to database as formated text. now while retriving data from database i can see html format data i need to format : Example
<B> test my text </B> new test. want to show in dagagrid like test my text new test: and when i click on datagrid i want to see test my text new test this format not styling below code for data grid
<asp:GridView ID = "gvNotes" AllowPaging ="false" PageSize = "5" PagerSettings-Visible = "false" Width = "99%"
CssClass = "Grid" EmptyDataText = "No records found." runat = "server" DataKeyNames = "NOTES_ID"
AutoGenerateColumns = "false" OnRowCommand="gvNotes_RowCommand" OnRowDataBound="gvNotes_RowDataBound">
<EmptyDataRowStyle HorizontalAlign = "Center" Height = "30px" />
<Columns>
<asp:BoundField DataField = "NOTES" HeaderText = "Notes">
<ItemStyle CssClass = "GridRow" HorizontalAlign = "left" Width = "60%" />
<HeaderStyle CssClass = "GridHeader" HorizontalAlign = "left" />
</asp:BoundField>
<asp:BoundField DataField = "DATE" HeaderText = "Note Added Date">
<ItemStyle CssClass = "GridRowPadRight" HorizontalAlign = "Right" Width = "20%" />
<HeaderStyle CssClass = "GridHeader" HorizontalAlign = "Right" />
</asp:BoundField>
<asp:TemplateField HeaderText="Edit">
<ItemStyle HorizontalAlign="Center" Width="5%" CssClass="GridRow" />
<HeaderStyle CssClass="GridHeader" HorizontalAlign="Center" />
<ItemTemplate>
<asp:ImageButton ID="btnEdit" ImageUrl="~/Images/Edit.jpg" ImageAlign="Middle" runat="server"
CommandName="Edt" CommandArgument='<%#((GridViewRow) Container).RowIndex %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete">
<ItemStyle HorizontalAlign="Center" Width="5%" CssClass="GridRow" />
<HeaderStyle CssClass="GridHeader" HorizontalAlign="Center" />
<ItemTemplate>
<asp:ImageButton ID="btnDelete" ImageUrl="~/Images/Delete.jpg" runat="server" CommandName="Del"
CommandArgument='<%#((GridViewRow) Container).RowIndex %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Below is House_info table in database
Id Behtop Service1 Service2 Service3 Name
1 1111 Ser1 Ser2 Ser3 Sara
2 2222 Ser4
I have lable=lblservice in my page that bind it from data base I want in lblservice show service1 and service2 and service3 column's data like below
ser1 , ser2 , ser3 so I wrote below code in SP
SUBSTRING (ISNULL([Service1]+','+' ',' ')+ISNULL([Service2]+','+' ',' ')+ISNULL([Service3]+','+' ',' ')+ISNULL(' ',' '),0,66)+'...'
as Service but here as you see in row with id=2 there isn't any data in service2 and service3 columns and just in service1 is data(ser4) so it show in lblservice data like below ser4, , , ...
but I want if in one of column doesn't be data it doesn't show (,) that come after data I mean I want if in 1 columns be data in show:
ser1,... NOT ==> ser1, , , ...
if in 2 columns be data shows
===>( ser1,ser2, ...) NOT ===>(ser1,ser2, , ...)
I have some field in datadase which is filled through checkboxlist , only selected checkbox has save to fields otherwise they remain blank: My problem is I want to show only filled value in label text using ";" , but when i am going to display it id display like:
[Code]....