views:

214

answers:

1

Hi everyone!

I need a quick hand figuring out what this code is doing, and how to make it work in vb.net

<%=Html.PageLinks((int(ViewData["CurrentPage"], (int)ViewData["Totalpages"], x=> Url.Action("List", new {page = x})) %>

i've figured out most of it. but the x=>Url.Action("List", new {page = x}) part is throwing me off. I tried reading about lamdas and such but i'm not quite getting it.

the pagelinks is defined like this:

_

Public Function PageLinks(ByVal html As HtmlHelper, ByVal currentPage As Integer, ByVal totalPages As Integer, ByVal pageUrl As Func(Of Integer, String)) As String
            Dim result As New StringBuilder
            For i As Integer = 1 To totalPages
                Dim tag As New TagBuilder("a")
                tag.MergeAttribute("href", pageUrl(i))
                tag.InnerHtml = i.ToString
                If i = currentPage Then
                    tag.AddCssClass("selected")

                End If
                result.AppendLine(tag.ToString())
            Next
            Return result.ToString
        End Function

which i THINK is the correct conversion from c#.

Thanks in advance!

Patricia

+1  A: 

I believe the correct conversion of C#:

x=> Url.Action("List", new {page = x})

would be in VB.Net:

Function(x) Url.Action("List", New With {.page = x})
CAbbott
That did the Trick! Thanks so much!
Patricia