Question:
ASP.NET / how do I refresh GridView?
DK
2008-05-06 12:48:45 UTC
Using ASP.NET for the first time.

Code below allows me to select a value from a dropdown box and enter a filter value in the text box. The GridView displays data based upon my search/filter criteria. It works...but only one time! How do I refresh the page/GridView control so I can use it over and over again?
---------------------------------------------------------
Dim strConnectionString As String
Dim strGetData As String
Dim strSearchValue As String
Dim strFilterValue As String

GridView1.DataSource = Nothing
strConnectionString = "C:\FDX\MyMeterWebsite\App_Data\Meters.mdb"

strSearchValue = Me.ddownList.Text
strFilterValue = Me.txtFilter.Text

strGetData = "Select * From Meters"
strGetData = strGetData & " Where " & strSearchValue
strGetData = strGetData & " Like '" & strFilterValue & "%'"
AccessMeters.DataFile = strConnectionString
AccessMeters.SelectCommand = strGetData
GridView1.DataSource = AccessMeters
---------------------------------------------------
Three answers:
iosmith
2008-05-06 13:27:12 UTC
Try adding "GridView1.DataBind()" after you've set the datasource.
casados
2016-10-31 04:06:41 UTC
Refresh Gridview
aryaxt
2008-05-06 19:04:50 UTC
gridviewName.databind()


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...