Advertisement
Guest User

Untitled

a guest
Oct 29th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.80 KB | None | 0 0
  1.     Protected Sub GridView1_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
  2.         If e.Row.RowType = DataControlRowType.DataRow Then
  3.             Dim lb As Label = CType(e.Row.FindControl("Label1"), Label)
  4.             lb.Text = "test"
  5.         End If
  6.  
  7.     End Sub
  8.  
  9.     Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
  10.         Dim dtTest As DataTable = New DataTable("Test")
  11.         dtTest.Columns.Add(New DataColumn("col1"))
  12.         dtTest.Columns.Add(New DataColumn("col2"))
  13.         Dim dwrTest As DataRow = dtTest.NewRow
  14.         dwrTest("col1") = "123"
  15.         dwrTest("col2") = "456"
  16.         dtTest.Rows.Add(dwrTest)
  17.         GridView1.DataSource = dtTest
  18.         GridView1.DataBind()
  19.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement