前端之家收集整理的这篇文章主要介绍了
[VB.NET]帮忙把下面这段web的程序改成vb.net,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
帮忙把下面这段web的程序改成vb.net 各位,如何将下面这个web的程序改成vb.net 的,谢谢!(本人没有接触过web,用的是vb.net,所以请大家帮帮忙) Partial Class _Default Inherits System.Web.UI.Page Private m_ldSortExpression As ListDictionary Private Property SortExpressions() As ListDictionary Get m_ldSortExpression = CType(ViewState( SortExpressions ),ListDictionary) If m_ldSortExpression Is Nothing Then m_ldSortExpression = New ListDictionary End If Return m_ldSortExpression End Get Set(ByVal value As ListDictionary) ViewState( SortExpressions ) = value End Set End Property Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then BindData() End If End Sub Sub BindData() Usually you would get the data from the database. To simplify the code,I will just fill a datatable with some standard data. Dim dt As New DataTable dt.Columns.Add( FirstName ) dt.Columns.Add( LastName ) dt.Columns.Add( Age ) dt.Columns.Add( Position ) dt.Rows.Add(New Object() { Sonu,Kapoor,28,Developer }) dt.Rows.Add(New Object() { Mike,Mustermann,31,IT-Lead }) dt.Rows.Add(New Object() { Jeff,Kolb,IT-Lead }) dt.Rows.Add(New Object() { Josh,Lucas,37,Support }) dt.Rows.Add(New Object() { Chris,Chuck,40,Technical Support }) Dim dv As DataView = dt.DefaultView use a stringbuilder to hold the sortexpression for the dataview Dim sbSortExpression As New StringBuilder If SortExpressions.Count > 0 Then Dim myKeys(SortExpressions.Count) As String SortExpressions.Keys.CopyTo(myKeys,0) For i As Integer = 0 To SortExpressions.Count - 1 sbSortExpression.Append(myKeys(i)) sbSortExpression.Append( ) sbSortExpression.Append(SortExpressions(myKeys(i))) If i <> SortExpressions.Count - 1 Then sbSortExpression.Append(,) End If Next lblSortExpression.Text = sbSortExpression.ToString usually we would send that sort-expression now to
sql via some stored-procedure dv.Sort = sbSortExpression.ToString Else lblSortExpression.Text = String.Empty End If GridView1.DataSource = dv GridView1.DataBind() End Sub Protected Sub GridView1_Sorting(ByVal sender As Object,ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting m_ldSortExpression = SortExpressions If Not m_ldSortExpression.Contains(e.SortExpression) Then m_ldSortExpression.Add(e.SortExpression,e.SortDirection.ToString.Replace( Ascending,ASC ).Replace( Descending,DESC )) Else Get sort direction Dim strSortDirection As String = m_ldSortExpression.Item(e.SortExpression) Was it ascending? If strSortDirection = ASC Then Yes,so sort in desc m_ldSortExpression.Item(e.SortExpression) = DESC ElseIf strSortDirection = DESC Then it is descending remove the sort order m_ldSortExpression.Remove(e.SortExpression) End If End If SortExpressions = m_ldSortExpression BindData() End Sub End Class __________________________________________________________________________ 帮顶上去 __________________________________________________________________________ 没人
回复,自己顶一下 __________________________________________________________________________ 顶顶顶 __________________________________________________________________________ 这就是vb.net的程序,不知楼主什么意思? __________________________________________________________________________ web程序当然可以用vb.net来写! __________________________________________________________________________ 是不是要把B/S的改成C/S __________________________________________________________________________ 我的意思将上面的
代码杆秤在winform中的,不是在web中的 谢谢大家先 __________________________________________________________________________ 顶一下... __________________________________________________________________________ 怎么没人顶,自己顶一下 __________________________________________________________________________
原文链接:https://www.f2er.com/vb/263570.html