View Single Post
 
Old November 22nd, 2009, 04:13 PM
headworth headworth is offline
Authorized User
 
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Angry DataGrid to filter name

Yes I used a example and modefied it
I have tried to do this another way and it loads when i debug
But when I select a employee and press filter it will not work?



[code]
Partial Public Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub

Protected Sub btnFilter_Click(ByVal sender As Object, ByVal e As EventArgs)

AccessDataSource1.SelectParameters.Clear()

Dim sqlSelectCommand As String = String.Concat(AccessDataSource1.SelectCommand, " WHERE Site_Employee LIKE '%'+?+'%'")

AccessDataSource1.SelectCommand = sqlSelectCommand

AccessDataSource1.SelectCommandType = SqlDataSourceCommandType.Text

AccessDataSource1.SelectParameters.Add(New ControlParameter("Site_Employee", "txtFilterCriteria", "Text"))

End Sub

Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles TextBox1.TextChanged

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
ResetDataSource()
End Sub

Protected Sub ResetDataSource()
'Remove the filter from the default select statement by using
'a new T-SQL statement that has no " where " clause.
AccessDataSource1.SelectCommand = "Select * From SWR2010"
End Sub
Protected Sub txtFilterCriteria_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub
End Class