kdeutsch
asked on
Use autocomplete textbox to refill gridview
WOndering if its possible to use a atuocomplete extender textbox outside of a datagriid to refresh data in grid as you type a name. So I load the grid initially with information and then as I type in my textbox I want information in grid to fall away till i get to the person I want. Is this possible??? and where do i start.
If its possible I will add full amount of points.
If its possible I will add full amount of points.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
Ok here is my code, what I do is fill the Gridview on a dropdown list event, then fill the gridview.
Protected Sub ddlTasks_SelectedIndexChan ged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlTasks.SelectedIndexChan ged
pnlGrid.Visible = True
FillGrid()
End Sub
Protected Sub txtFindSoldier_TextChanged (ByVal sender As Object, ByVal e As System.EventArgs) Handles txtFindSoldier.TextChanged
FillGrid()
End Sub
Private Sub FillGrid()
Dim srp As Integer = ddlSrpEvent.SelectedValue
Dim cat As Integer = ddlTasks.SelectedValue
Dim theCounter As Integer
Dim SqlWhere As String
If HFID.Value = "" Then
SqlWhere = ""
Else
SqlWhere = "AND ed.intPersonnelID = '" & HFID.Value & "'"
End If
sql = "Select ed.intDataId, q.strTask, ed.intAnswer as Answer, ed.strData, ed.strRemarks, strDocDate, w.strFullName From tblSRPEventData as ed INNER JOIN tblSRPQuestion as q on " _
& "q.intQuestionId = ed.intQuestionId INNER JOIN " _
& "tblQuestionCategory as qc on qc.intCategoryId = q.intCategoryID INNER JOIN WORSDotNet.dbo.tblUser as w on w.strSSN = cast(ed.intPersonnelID as varchar) Where q.intcategoryId = " & cat & " and " _
& "intEventId = " & srp & " and intAnswer = 1 " & SqlWhere & " Order by w.strFullname"
myGridview.DataSource = getData(sql)
myGridview.DataBind()
For theCounter = 0 To myGridview.Rows.Count - 1
Next
lblCount.Text = theCounter & " Records"
'Wipe the HFID for onload events
HFID.Value = Nothing
txtFindSoldier.Text = String.Empty
End Sub
Ok here is my code, what I do is fill the Gridview on a dropdown list event, then fill the gridview.
Protected Sub ddlTasks_SelectedIndexChan
pnlGrid.Visible = True
FillGrid()
End Sub
Protected Sub txtFindSoldier_TextChanged
FillGrid()
End Sub
Private Sub FillGrid()
Dim srp As Integer = ddlSrpEvent.SelectedValue
Dim cat As Integer = ddlTasks.SelectedValue
Dim theCounter As Integer
Dim SqlWhere As String
If HFID.Value = "" Then
SqlWhere = ""
Else
SqlWhere = "AND ed.intPersonnelID = '" & HFID.Value & "'"
End If
sql = "Select ed.intDataId, q.strTask, ed.intAnswer as Answer, ed.strData, ed.strRemarks, strDocDate, w.strFullName From tblSRPEventData as ed INNER JOIN tblSRPQuestion as q on " _
& "q.intQuestionId = ed.intQuestionId INNER JOIN " _
& "tblQuestionCategory as qc on qc.intCategoryId = q.intCategoryID INNER JOIN WORSDotNet.dbo.tblUser as w on w.strSSN = cast(ed.intPersonnelID as varchar) Where q.intcategoryId = " & cat & " and " _
& "intEventId = " & srp & " and intAnswer = 1 " & SqlWhere & " Order by w.strFullname"
myGridview.DataSource = getData(sql)
myGridview.DataBind()
For theCounter = 0 To myGridview.Rows.Count - 1
Next
lblCount.Text = theCounter & " Records"
'Wipe the HFID for onload events
HFID.Value = Nothing
txtFindSoldier.Text = String.Empty
End Sub
ASKER
All,
Ok I got it to work to filter, but I the gird doe not change as it filters.
Protected Sub ddlTasks_SelectedIndexChan ged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlTasks.SelectedIndexChan ged
pnlGrid.Visible = True
FillGrid()
End Sub
Protected Sub txtFindSoldier_TextChanged (ByVal sender As Object, ByVal e As System.EventArgs) Handles txtFindSoldier.TextChanged
myDataTable = CType(Session("mydataTable "), DataTable)
myDataTable.DefaultView.Ro wFilter = "strFullname like '%" & txtFindSoldier.Text & "&'"
FillGrid()
End Sub
Private Sub FillGrid()
Dim srp As Integer = ddlSrpEvent.SelectedValue
Dim cat As Integer = ddlTasks.SelectedValue
Dim theCounter As Integer
Dim SqlWhere As String
'If HFID.Value = "" Then
' SqlWhere = ""
'Else
' SqlWhere = "AND ed.intPersonnelID = '" & HFID.Value & "'"
'End If
sql = "Select ed.intDataId, q.strTask, ed.intAnswer as Answer, ed.strData, ed.strRemarks, strDocDate, w.strFullName From tblSRPEventData as ed INNER JOIN tblSRPQuestion as q on " _
& "q.intQuestionId = ed.intQuestionId INNER JOIN " _
& "tblQuestionCategory as qc on qc.intCategoryId = q.intCategoryID INNER JOIN WORSDotNet.dbo.tblUser as w on w.strSSN = cast(ed.intPersonnelID as varchar) Where q.intcategoryId = " & cat & " and " _
& "intEventId = " & srp & " and intAnswer = 1 Order by w.strFullname"
myDataTable = New DataTable
myDataTable = getData(sql)
Session("myDataTable") = myDataTable
myGridview.DataSource = myDataTable
myGridview.DataBind()
For theCounter = 0 To myGridview.Rows.Count - 1
Next
lblCount.Text = theCounter & " Records"
'Wipe the HFID for onload events
HFID.Value = Nothing
txtFindSoldier.Text = String.Empty
End Sub
Ok I got it to work to filter, but I the gird doe not change as it filters.
Protected Sub ddlTasks_SelectedIndexChan
pnlGrid.Visible = True
FillGrid()
End Sub
Protected Sub txtFindSoldier_TextChanged
myDataTable = CType(Session("mydataTable
myDataTable.DefaultView.Ro
FillGrid()
End Sub
Private Sub FillGrid()
Dim srp As Integer = ddlSrpEvent.SelectedValue
Dim cat As Integer = ddlTasks.SelectedValue
Dim theCounter As Integer
Dim SqlWhere As String
'If HFID.Value = "" Then
' SqlWhere = ""
'Else
' SqlWhere = "AND ed.intPersonnelID = '" & HFID.Value & "'"
'End If
sql = "Select ed.intDataId, q.strTask, ed.intAnswer as Answer, ed.strData, ed.strRemarks, strDocDate, w.strFullName From tblSRPEventData as ed INNER JOIN tblSRPQuestion as q on " _
& "q.intQuestionId = ed.intQuestionId INNER JOIN " _
& "tblQuestionCategory as qc on qc.intCategoryId = q.intCategoryID INNER JOIN WORSDotNet.dbo.tblUser as w on w.strSSN = cast(ed.intPersonnelID as varchar) Where q.intcategoryId = " & cat & " and " _
& "intEventId = " & srp & " and intAnswer = 1 Order by w.strFullname"
myDataTable = New DataTable
myDataTable = getData(sql)
Session("myDataTable") = myDataTable
myGridview.DataSource = myDataTable
myGridview.DataBind()
For theCounter = 0 To myGridview.Rows.Count - 1
Next
lblCount.Text = theCounter & " Records"
'Wipe the HFID for onload events
HFID.Value = Nothing
txtFindSoldier.Text = String.Empty
End Sub
ASKER
No response, to finish out, changed to another method.
Also, the logic depends if you are just trimming data already in the grid or forcing a new population of data in the grid from the store based on what the user enters. If you populate the grid with the first records and the user's first letter requires records not yet read in, they you need to build a query according and pull the data from the store according per the new query.