本文介绍了vb.net到c#convertion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 如何将此vb.net代码转换为c# 私有 Sub Yourgrid_RowCreated( ByVal sender As 对象, ByVal e As System.Web .UI.WebControls.GridViewRowEventArgs) 句柄 Yourgrid.RowCreated 选择 Case e.Row.RowType Case DataControlRowType.Pager Dim ddlPager As 新 DropDownList ddlPager.ID = DdlPager ddlPager.AutoPostBack = True ddlPager.ToolTip = 更改Pagesize ddlPager.Items.Add( 5) ddlPager.Items.Add( 10) ddlPager.Items.Add( 25) ddlPager.Items.Add( 50) ddlPager.Items.Add( 100) ddlPager.SelectedValue = 10 AddHandler ddlPager.SelectedIndexChanged, AddressOf Me .PageSizeChanged e.Row.Cells( 0 )。ColumnSpan - = 1 Dim td 作为 新 TableCell Dim span1 As New 标签 span1.Text = 显示 span1.Style ( margin-left)= 50px td.Controls.Add(span1) td.Controls.Add(ddlPager) Dim span2 作为 新标签 span2.Text = 每页行数 td.Controls.Add(span2) e .Row.Cells.Add(td) En d 选择 结束 Sub 私有 Sub PageSizeChanged( ByVal 发件人作为 对象, ByVal e As System.EventArgs) Dim ddlPager As DropDownList = DirectCast (sender,DropDownList) Dim newPageSize As Int32 = Int32 .Parse(ddlPager。 SelectedValue) YourGrid.PageSize = newPageSize ' 更改th e Grid的PageSize DataBindYourGrid()' 调用将网格绑定到的函数数据源' UpdYourgrid.Update()' 如果您使用Ajax,请更新UpdatePanel此GridView' 结束 Sub 解决方案 尝试使用代码转换器: 将VB.NET转换为C# [ ^ ] 将VB转换为C#或C#转换为VB [ ^ ] codeTranslator :来自VB.NET的代码翻译< - > C# [ ^ ] 这些是 Google [ ^ ] 使用此 http://www.developerfusion.com/tools/convert/vb-to-csharp/ [ ^ ] 您好使用此链接: http://www.developerfusion.com /工具/转换/ VB- to-csharp / [ ^ how to convert this vb.net code into c#Private Sub Yourgrid_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles Yourgrid.RowCreated Select Case e.Row.RowType Case DataControlRowType.Pager Dim ddlPager As New DropDownList ddlPager.ID = "DdlPager" ddlPager.AutoPostBack = True ddlPager.ToolTip = "Change Pagesize" ddlPager.Items.Add("5") ddlPager.Items.Add("10") ddlPager.Items.Add("25") ddlPager.Items.Add("50") ddlPager.Items.Add("100") ddlPager.SelectedValue = "10" AddHandler ddlPager.SelectedIndexChanged, AddressOf Me.PageSizeChanged e.Row.Cells(0).ColumnSpan -= 1 Dim td As New TableCell Dim span1 As New Label span1.Text = "Show" span1.Style("margin-left") = "50px" td.Controls.Add(span1) td.Controls.Add(ddlPager) Dim span2 As New Label span2.Text = "rows per page" td.Controls.Add(span2) e.Row.Cells.Add(td) End Select End Sub Private Sub PageSizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dim ddlPager As DropDownList = DirectCast(sender, DropDownList) Dim newPageSize As Int32 = Int32.Parse(ddlPager.SelectedValue) YourGrid.PageSize = newPageSize 'change the PageSize of the Grid' DataBindYourGrid() 'call the function that Binds your grid to the Datasource' UpdYourgrid.Update() 'if you use Ajax, update the UpdatePanel of this GridView' End Sub 解决方案 Try using code converter:Convert VB.NET to C#[^]Convert VB to C# or C# to VB[^]CodeTranslator: Code Translation From VB.NET <-> C#[^]Those are top links from Google[^]Use thishttp://www.developerfusion.com/tools/convert/vb-to-csharp/[^]Hi Use this link:http://www.developerfusion.com/tools/convert/vb-to-csharp/[^] 这篇关于vb.net到c#convertion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-29 11:04