Dim sql As String
sql = "SELECT * FROM Supplier "
If IsFind = True Then
ds.Tables("Supplier").Clear() 'ล้างข้อมูลออกก่อน
End If
Dim da As New SqlClient.SqlDataAdapter(sql, Conn)
da.Fill(ds, "Supplier")
Dim dvm As New DataViewManager()
dvm.DataSet = ds
If ds.Tables("Supplier").Rows.Count <> 0 Then 'ถ้ามีจำนวน record แล้ว
IsFind = True
Dim dvs As DataViewSetting
dvs = dvm.DataViewSettings("Supplier")
dvs.Sort = "ID"
dvs.RowFilter = "NameThai LIKE'" & txtsearch.Text & "%'"
With SupplierGrid
.ReadOnly = True
.DataSource = dvm 'ds.Tables("Supplier")
.DataMember = "Supplier"
' .DataSource = ds.Tables("Supplier")
'.DataMember = "Supplier"
End With
Else
IsFind = False
End If
Sub myDataGrid_ItemDataBound(sender As Object, e As DataGridItemEventArgs)
'*** CustomerID ***'
Dim lblCustomerID As Label = CType(e.Item.FindControl("lblCustomerID"),Label)
IF Not IsNothing(lblCustomerID) Then
lblCustomerID.Text = e.Item.DataItem("CustomerID")
End IF
End Sub