Click here to Skip to main content
15,891,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everyone,

I have an problem. I have a Database with 6 columns.1st column contains ID, Second Column contains Role_Name, third column is Checkin_Add,4th column is Checkin_View. And 5th column is Checkin_Edit and 6th column is checkin_Delete. In my Role.aspx page i have taken a gridview with datasource of this database. I have to create checkboxes for the columnd add ,edit,view, delete.and when i check the checkboxes database shoud be updated as yes else no. Which will be yes in the database only that access are provided to the authenticated users. how will i do it .Kindly help
Posted

You have to create one more table in Db like tblfuncton and that should contains

all page information here

for example

FunID, FunName, Add, Edit, Delete, View, Print
001 Customerpage Y Y Y Y N
...
...
...



Then take this in list (only FunID,FunName) bind it in gridview with templatefeild(Add, Edit,Delete,View,Print) checkboxs

You have to map FunID to RoleID
 
Share this answer
 
v2
Comments
Member 10578683 7-Mar-14 6:45am    
Actually i have done one database Role in which I have columns such as Role_Id Role_Name Customerpage_Add, CustomerPage_Delete,customerPage_Edit,Productpage_Add,Productpade_View like this for all pages in one database. so here mapping is not required.My problem is how will i assign these roles to authenticated users. Suppose i have a role Supervisor. i want that supervisor can only view permission. the how will i map or do this
Amalraj Ramesh 7-Mar-14 7:09am    
Thats fine.. U have to add new unique id for every role for example Admin=1,Supervisor=2 and map to userid
Amalraj Ramesh 7-Mar-14 7:10am    
Can u give me some sample data for role table
Member 10578683 7-Mar-14 7:17am    
Role_Id Role_Name CheckinPage_Add CheckinPage_delete CheckinPage_View Productpage_Add,
1 Admin chkbox1 chkbox2 checkbox3 checkbox4
2 User chkbox1 chkbox2 checkbox3 checkbox4
like this
Member 10578683 7-Mar-14 7:25am    
how to map that is my problem can you give some code. i am new to this field
In Submit Button Click

SubmitButtonClick(.....)
{
DataTable dt = new DataTable();
dt.Columns.Add("Add");
dt.Columns.Add("Edit");
.
.
.
DataRow newrow = null;
foreach (GridViewRow row in grdID.Rows)
{
newrow = dt.NewRow();
if (((CheckBox)row.FindControl("ChkAdd") as System.Web.UI.WebControls.CheckBox).Checked == true)
newrow["Add"] = "Y";
else
newrow["Add"] = "N";

if (((CheckBox)row.FindControl("ChkEdit") as System.Web.UI.WebControls.CheckBox).Checked == true)
newrow["Edit"] = "Y";
else
newrow["Edit"] = "N";
.
.
.
.
dt.Rows.Add(newrow);
}

//finally all in thi dt
}
 
Share this answer
 
Comments
Member 10578683 7-Mar-14 8:34am    
will i take all the checkboxes in template field
Amalraj Ramesh 7-Mar-14 8:45am    
yes
Member 10578683 10-Mar-14 2:07am    
I did like this u have said. But how Y will be inserted into my database. Table Name is Role.
Member 10578683 10-Mar-14 2:38am    
The corresponding column of the role field in the database the Y value is not inserting

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900