'Iterating through the Table If (ds.Tables(0).Rows.Count > 0) Then 'Reading row by row from DB Dim ros As Int32 = ds.Tables(0).Rows.Count - 1 Do While ros >= 0 Dim tr As TableRow = New TableRow() Dim tc As TableCell = New TableCell() Dim btnUser As LinkButton = New LinkButton() AddHandler btnUser.Click, AddressOf btnUser_Click btnUser.ID = (ds.Tables(0).Rows(ros)("UserName")).ToString tc.Controls.Add(btnUser) tr.Cells.Add(tc) tbl.Rows.Add(tr) ros = ros - 1 Loop End If
Private Sub btnUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 'setting the session value Dim btn As LinkButton = sender Dim newsId As String = btn.ID.ToString Session("SearchedUserName") = newsId End Sub
Init
PreInit
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)