【发布时间】:2020-11-28 14:38:35
【问题描述】:
我的 asp.net 页面中有两个网格 - vb.net,autogeneratecolumn 设置为 true。 我绑定了列相同但数据不同的两个网格。 现在我想在grid2中设置列的宽度,就像在grid1中一样。 任何人都可以帮助我。 我试图在后面的代码中设置为:
Private Sub grid2_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles grid2.RowDataBound
For i = 0 To grid1.Rows(0).Cells.Count - 1
e.Row.Cells(i).Width = grid1.HeaderRow.Cells(i).Width
Next
End Sub
但是grid1.HeaderRow.Cells(i).Width 给了我 0 作为值。
【问题讨论】: