**********
CODE BEHIND (.VB)
**********
DataSet used to bind to GV
==========================
Protected Function GetNewHireRequests(ByVal status As Integer) As DataSet
Dim NHcmd As New SqlCommand("usp_NewHireStatus", conn)
NHcmd.CommandType = Data.CommandType.StoredProcedure
NHcmd.Parameters.AddWithValue("@approvalMgrID", Data.SqlDbType.Int)
NHcmd.Parameters("@approvalMgrID").Value = CInt(Session("ApprovingMgrID"))
NHcmd.Parameters.AddWithValue("@status", Data.SqlDbType.Int)
NHcmd.Parameters("@status").Value = status
Dim da As SqlDataAdapter
Dim ds2 As New DataSet
da = New SqlDataAdapter(NHcmd)
ds2 = New DataSet()
da.Fill(ds2)
Return ds2
End Function
GridView Bind
=================
Protected Sub gv_GetApprovedNewHireRequests()
If GetNewHireRequests(approvedStatusID).Tables(0).Rows.Count > 0 Then
gv_ApprovalNewHires.AutoGenerateColumns = False
gv_ApprovalNewHires.DataSource = GetNewHireRequests(approvedStatusID)
gv_ApprovalNewHires.DataBind()
End If
End Sub
gv_RowCommand Event
======================
Protected Sub gv_ApprovalNewHires_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gv_ApprovalNewHires.RowCommand
If e.CommandName = "Select" Then
Dim row_index As Integer = e.CommandArgument.ToString()
Dim SelectedEmpID As String = gv_ApprovalNewHires.DataKeys(row_index)(0).ToString()
'do something to bind fv control here...???
End If
End Sub
***********************
.ASPX
***********************
GridView - Master
==============
asp:Label ID="pending_lblJobTitle" runat="server" Text='<%# Eval("JOB_TITLE")%>'>
FormView - Detail
==============
">
|