TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
User Rights : Allocation of User Rights in ASP.NET using C#
Mohammed Zaid Meraj
Mar 03
2016
Code
1.6
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
HTML Markup:
<ul
class
=
"sub"
>
<li id=
"State_li"
runat=
"server"
><a href=
"State.aspx"
>State</a></li>
<li id=
"City_li"
runat=
"server"
><a href=
"City.aspx"
>City</a></li>
<li id=
"Department_li"
runat=
"server"
><a href=
"Department.aspx"
>Department</a></li>
<li id=
"Designation_li"
runat=
"server"
> <a href=
"Designation.aspx"
>Designation</a></li>
<li id=
"Bank_li"
runat=
"server"
> <a href=
"Bank.aspx"
>Bank</a></li>
<%--<li ><a href=
"Category.aspx"
>Category</a></li>--%>
<li id=
"Package_li"
runat=
"server"
><a href=
"Package.aspx"
>Package</a></li>
<li id=
"Product_li"
runat=
"server"
><a href=
"Product.aspx"
>Product</a></li>
<li id=
"Company_li"
runat=
"server"
><a href=
"Company.aspx"
>Company</a></li>
<li id=
"Branch_li"
runat=
"server"
> <a href=
"Branch.aspx"
>Branch</a></li>
<li id=
"User_li"
runat=
"server"
><a href=
"User.aspx"
>User</a></li>
<li id=
"Mail_li"
runat=
"server"
><a href=
"Mail_template.aspx"
>Mail Template</a></li>
<li id=
"Sms_li"
runat=
"server"
><a href=
"Sms_template.aspx"
>SMS Template</a></li>
<li id=
"Form_li"
runat=
"server"
><a href=
"FormMaster.aspx"
>Form</a></li>
<li id=
"Rights_li"
runat=
"server"
><a href=
"UserRights.aspx"
>User Rights</a></li>
<li id=
"Setting_li"
runat=
"server"
><a href=
"Setting.aspx"
>Settings</a></li>
</ul>
C#
protected
void
Page_Load(
object
sender,
EventArgs e)
{
lblUserName.Text = clsVariable.User_name;
//string str_cont = "Country";
string
str =
"Select * from right_view where Designation_id='"
+
clsVariable.User_id +
"'"
;
DataTable dt = c1.filldt(str);
if
(dt.Rows.Count > 0)
{
for
(
int
i = 0; i < dt.Rows.Count; i++)
{
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"Mail Template"
)
{
Mail_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"State"
)
{
State_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"City"
)
{
City_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"Department"
)
{
Department_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"Designation"
)
{
Designation_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"Bank"
)
{
Bank_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"Package"
)
{
Package_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"Product"
)
{
Product_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"Company"
)
{
Company_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"Branch"
)
{
Branch_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"User"
)
{
User_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"SMS Template"
)
{
Sms_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"Form"
)
{
Form_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"User Rights"
)
{
Rights_li.Visible =
false
;
}
if
(dt.Rows[i][
"View"
].ToString() ==
"0"
&& dt.Rows[i][
"Form_name"
].ToString() ==
"Settings"
)
{
Setting_li.Visible =
false
;
}
}
}
}
}
Asp.Net
C#