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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Najim Mulla
836
971
75.1k
how can public function is convert to session
Nov 17 2014 6:47 AM
private
void
GetMenuData()
{
try
{
string
meanu_id =
""
, a =
""
;
SqlParameter
[] paramater1 =
new
SqlParameter
[]
{
new
SqlParameter
(
"@Branch"
,1),
new
SqlParameter
(
"@Users"
,1),
};
SqlDataReader
dr = (
SqlDataReader
)db.ExecuteReader(
"GetRoll_ForMeanu"
, paramater1);
if
(dr.HasRows)
{
dr.Read();
meanu_id = dr[
"Menu_Id"
].ToString();
a = dr[
"Role"
].ToString();
}
dr.Close();
DataTable
dt =
new
DataTable
();
// dt = (DataTable)db.TableFill1("MenuMaster_SelectQuery");
dt = (
DataTable
)db.Meanu_Fill(
"SELECT menu_id, menu_name, menu_parent_id, menu_url, Target FROM MenuMaster where menu_id in("
+ meanu_id +
") Order By menu_id"
);
DataView
view =
new
DataView
(dt);
view.RowFilter =
"menu_parent_id is NULL"
;
foreach
(
DataRowView
row
in
view)
{
MenuItem
menuItem =
new
MenuItem
(row[
"menu_name"
].ToString(), row[
"menu_id"
].ToString());
menuItem.NavigateUrl = row[
"menu_url"
].ToString();
Menu1.Items.Add(menuItem);
AddChildItems(dt, menuItem);
//Session["menu"] = menuItem;
}
}
catch
(
Exception
ex)
{
db.MessageBox(ex.Message,
this
);
}
}
private
void
AddChildItems(
DataTable
table,
MenuItem
menuItem)
{
DataView
viewItem =
new
DataView
(table);
viewItem.RowFilter =
"menu_parent_id="
+ menuItem.Value;
foreach
(
DataRowView
childView
in
viewItem)
{
MenuItem
childItem =
new
MenuItem
(childView[
"menu_name"
].ToString(), childView[
"menu_id"
].ToString());
childItem.NavigateUrl = childView[
"menu_url"
].ToString();
childItem.Target = childView[
"Target"
].ToString();
menuItem.ChildItems.Add(childItem);
AddChildItems(table, childItem);
}
}
sir this is my function how to convert
Session["GetMenuData"]= GetMenuData();
Attachment:
private void getmenudata.rar
Reply
Answers (
0
)
check spell option in Richtextbox using c# HTML Editor
Regex need