G
Guest
Hi,
I am trying to build a simple web page that displays records returned from
an MS Access db when the user enters search criteria in a text box on the
same page. My page comprises of a label, textbox and a button, together with
an unbound GridView
and an AccessDataSource control.
In the Page_Load event, I have the following code:
if (!IsPostBack)
{
GridView1.Visible = false;
}
else
{
// Get search term entered by user.
string searchTerm = textSearch.Text;
// Query the database for matching records.
AccessDataSource1.SelectCommand = string.Format("SELECT *
FROM MyTable WHERE Column1 LIKE '%{0}%'", searchTerm);
GridView1.DataSource =
AccessDataSource1.Select(DataSourceSelectArguments.Empty);
GridView1.DataBind();
GridView1.Visible = true;
My problem is that when I step through the code, I can verify that the
DataView returned by the AccessDataSource.Select() method contains data, yet
the GridView does not show on the page.
What am I doing wrong?
Jazza
I am trying to build a simple web page that displays records returned from
an MS Access db when the user enters search criteria in a text box on the
same page. My page comprises of a label, textbox and a button, together with
an unbound GridView
and an AccessDataSource control.
In the Page_Load event, I have the following code:
if (!IsPostBack)
{
GridView1.Visible = false;
}
else
{
// Get search term entered by user.
string searchTerm = textSearch.Text;
// Query the database for matching records.
AccessDataSource1.SelectCommand = string.Format("SELECT *
FROM MyTable WHERE Column1 LIKE '%{0}%'", searchTerm);
GridView1.DataSource =
AccessDataSource1.Select(DataSourceSelectArguments.Empty);
GridView1.DataBind();
GridView1.Visible = true;
My problem is that when I step through the code, I can verify that the
DataView returned by the AccessDataSource.Select() method contains data, yet
the GridView does not show on the page.
What am I doing wrong?
Jazza