Protected Sub btn_SearchClick(ByVal sender As Object, ByVal e As EventArgs) Handles btnSearch.Click
Dim objWo As workorder = New workorder
Dim dt As DataTable
dt = objWo.selectWorkorder(txtWo.Text)
MsgBox(objWo.errorMessage)
If dt.Rows.Count > 0 Then
myGridview.DataSource = dt
myGridview.DataBind()
'Me.Label1.Text = "<a href = frm_addpm.aspx>ลิ้งไปหน้า Pm</a>"
End If
End Sub
Protected Sub myGridView_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles myGridview.RowDataBound
Dim lblWonum As Label = CType(e.Row.FindControl("lblWonum"), Label)
If Not IsNothing(lblWonum) Then
lblWonum.Text = e.Row.DataItem("wonum")
End If
'*** Email ***'
Dim lblDescwo As Label = CType(e.Row.FindControl("lblDescwo"), Label)
If Not IsNothing(lblDescwo) Then
lblDescwo.Text = e.Row.DataItem("description_wo")
End If
Dim lblPmnum As Label = CType(e.Row.FindControl("lblPmnum"), Label)
If Not IsNothing(lblPmnum) Then
lblPmnum.Text = e.Row.DataItem("pmnum")
End If
'*** Email ***'
Dim lblItemnum As Label = CType(e.Row.FindControl("lblItemnum"), Label)
If Not IsNothing(lblItemnum) Then
lblItemnum.Text = e.Row.DataItem("Itemnum")
End If
End Sub
Protected Sub myGridview_RoCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles myGridview.RowCommand
Dim i As Integer
Dim btnSelect As Button
Dim lblId As Label
For i = 0 To myGridview.Rows.Count - 1
If e.CommandName = "select" Then
btnSelect = myGridview.Rows(i).FindControl("btnSelectId")
'txtWo.Text = myGridview.Rows(i).FindControl("lblWonum").ToString
'txtDesc.Text = myGridview.Rows(i).FindControl("lbl_Wodescription").ToString
lblId = myGridview.Rows(i).FindControl("lblWonum")
Me.lbl1.Text = lblId.Text
End If
Next
End Sub
Protected Sub selectIndex_(ByVal sender As Object, ByVal e As EventArgs) Handles myGridview.SelectedIndexChanged
Dim row As GridViewRow = myGridview.SelectedRow
txtWo.Text = myGridview.SelectedValue
txtDesc.Text=row.Cells(2).text
Dim strDatakeys As String = myGridview.SelectedValue
End Sub
Private Sub DataGridView1_CellMouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseUp
If e.RowIndex = -1 Then Exit Sub
With DataGridView1
frmFilingtax.txtOWNERID_HOUSE.Text = .Rows.Item(e.RowIndex).Cells("PID").Value.ToString()
frmFilingtax.lblPOPID_house.Text = .Rows.Item(e.RowIndex).Cells("POPID").Value.ToString()
frmFilingtax.lblADDRESS_HOUSE.Text = .Rows.Item(e.RowIndex).Cells("HOUSENO").Value.ToString() + " หมู่ที่" + .Rows.Item(e.RowIndex).Cells("MOO").Value.ToString() + " ต." + .Rows.Item(e.RowIndex).Cells("TAMBON_TH").Value.ToString() + " อ." + .Rows.Item(e.RowIndex).Cells("DISTRICT_TH").Value.ToString() + " จ." + .Rows.Item(e.RowIndex).Cells("PROVINCE_TH").Value.ToString() + " " + .Rows.Item(e.RowIndex).Cells("ZIPCODE").Value.ToString()
End With
End Sub