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
jorge graur
NA
62
656
mvc 4 asp vb.net runtime menu building problem
Jul 31 2017 10:49 AM
Hi.
I am iniciate in mvc4, and need help.
my code is
@Code
For Each dr As Data.DataRow In ViewBag.MenuList.rows
Dim mm As String = dr.Item(2).ToString
@:
@Html.ActionLink(mm, "#", "#")
@:
For Each drCat As Data.DataRow In ViewBag.getSubMenu(mm).rows <- problem is hear
@:
@Html.ActionLink(drCat.Item(2).ToString, "#", "#")
@:
Next
@:
@:
Next
End code
Controller :
Function getSubMenu(ByVal sMenu As String) As ActionResult
Try
'cCon = New SqlConnection(sCon)
'cCon.Open()
Dim subMenuCatList As New clsCategorias
subMenuCatList.cConn = cCon
subMenuCatList.MenuStr = sMenu
Dim dsCat As DataSet = subMenuCatList.GetListCategories()
ViewBag.MenuList = dsCat.Tables(0)
Dim a As New List(Of String)
For Each el As DataRow In dsCat.Tables(0).Rows
a.Add(el(0) & ";" & el(2))
Next
Session("myMenuCatList") = a
Return View(a)
Catch ex As Exception
Throw ex
Finally
cCon.Close()
End Try
I am trying to build the menu in "runtime", the first level of the menu is being returned well, but when I am passing a parameter to fill the second level of the menu the system gives an error. I think the problem is in passing the parameter. Can someone help?
Thancks
Reply
Answers (
1
)
Asp.net(c#) code to convert html content to an image
Bulk Email Response