工作总结1

  1. ‘document.getElementById('id').setAttribute('value',result)’ has different performance between IE and Firefox. IE don’t get the value in the controller use Request(‘id’) when result is an array.

          Solution: use ‘document.getElementById('id').value=result’ instead.

     2. Hidden url parameters

Function PostLink(ByVal helper As HtmlHelper, ByVal formId As String, ByVal linkText As String, ByVal className As String, _
                      ByVal action As String, ByVal controller As String, ByVal ParamArray postData As String()) As String

        Dim r As HttpResponseBase = helper.ViewContext.HttpContext.Response
        helper.BeginForm(action, controller, Nothing, FormMethod.Post, New With {.id = formId})
        For Each d In postData
            Dim w As String() = d.Split("=")
            If (w.Length >= 2) Then
                r.Write(helper.Hidden(w(0), w(1)))
            End If
        Next
        Dim _class = ""
        If (className IsNot Nothing) Then
            _class = "class=""" & className & """"
        End If
        r.Write("<a " & _class & " href=""javascript:document.getElementById('" + formId + "').submit()"">" + linkText + "</a>")
        helper.EndForm()
        Return ""
    End Function
View Code

 

posted @ 2013-08-13 14:56  Tbeck  阅读(227)  评论(0编辑  收藏  举报