If e.CommandName = "cmdSelect" Then
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim row As GridViewRow = gvCheckList.Rows(index)
Me.hidIDKaunseling.Value = Convert.ToString(row.Cells(5).Text)
Me.lblMatricNo.Text = Convert.ToString(row.Cells(6).Text)
dbconn = New OleDb.OleDbConnection(strCon)
dbconn.Open()
sql = "SELECT a.MatricNo, b.Name, b.Faculty, a.Date, a.KaunselingID, b.TelNo, " _
& "c.Officer " _
& "FROM KaunselingPL AS a " _
& "INNER JOIN DbStudent..Personal AS b ON a.MatricNo = b.MatricNo " _
& "INNER JOIN KaunselingDT AS c ON a.KaunselingID = c.KaunselingID " _
& "WHERE (a.Status = '2' and a.MatricNo='" & Me.lblMatricNo.Text & "'"
dbcomm = New OleDbCommand(sql, dbconn)
dbread = dbcomm.ExecuteReader()
dbread.Read()
Me.lblName.Text = dbread("Name")
Me.lblMatricNo.Text = dbread("MatricNo")
Me.lblFaculty.Text = dbread("Faculty")
Me.lblTelNo.Text = dbread("TelNo")
Me.lblDate.Text = CDate(dbread("Date")).ToString("dd/MM/yyyy")
Me.lblOfficer.Text = dbread("Officer")
dbread.Close()
dbcomm = Nothing
dbconn.Close()
End If
<asp:gridview id="gvCheckList" cssclass="gridViewTable" autogeneratecolumns="False" allowpaging="True" width="100%" emptydatatext="No Record" runat="server" pagesize="20" onrowcommand="gvCheckList_RowCommand" xmlns:asp="#unknown">
<footerstyle cssclass="gridViewFooter" />
<HeaderStyle CssClass="gridViewHeader" />
<alternatingrowstyle cssclass="gridViewAlternating" />
<columns>
<asp:boundfield datafield="ROWNUMBER" headertext="No." headerstyle-width="2%"></asp:boundfield>
<asp:buttonfield datatextfield="MatricNo" commandname="cmdSelect" headertext="Matric No." meta:resourcekey="ButtonFieldResource1" headerstyle-width="15%" xmlns:meta="#unknown"></asp:buttonfield>
<asp:boundfield datafield="Name" headertext="Student's Name" headerstyle-width="35%"></asp:boundfield>
<asp:boundfield datafield="Faculty" headertext="Fakulti" headerstyle-width="25%"></asp:boundfield>
<asp:boundfield datafield="Date" headertext="Date" headerstyle-width="25%" dataformatstring="{0:dd/MM/yyyy}"></asp:boundfield>
<asp:boundfield datafield="KaunselingID" headertext="Hidden">
<itemstyle cssclass="hidden" verticalalign="Top" />
<HeaderStyle CssClass="hidden" />
<footerstyle cssclass="hidden" />
</asp:boundfield>
<asp:boundfield datafield="Matric No." headertext="Hidden">
<itemstyle cssclass="hidden" verticalalign="Top" />
<HeaderStyle CssClass="hidden" />
<footerstyle cssclass="hidden" />
</asp:boundfield>
</columns>
<footerstyle cssclass="gridViewFooter" />
<HeaderStyle ForeColor="White" CssClass="gridViewHeader" />
<pagersettings firstpagetext="<<" lastpagetext=">>" mode="NextPreviousFirstLast" nextpagetext=">" previouspagetext="<" />
</asp:gridview>