D
Dan11
here's C sharp code:
Start code...
private void searchBtn_Click(object sender, System.EventArgs e)
{
//For sqlCommand1 is a search by Wkst ID (employeeID on pubs) params
if (txtEmployeeID.Text.Length > 0)
{
sqlCommand1.Parameters["@txtEmployeeID"].Value =
txtEmployeeID.Text;
sqlConnectSMS.Open();
System.Data.SqlClient.SqlDataReader dreader;
dreader = sqlCommand1.ExecuteReader();
DataGrid1.DataSource = dreader;
DataGrid1.DataBind();
dreader.Close();
sqlConnectSMS.Close();
}
else
{
//resets the data source to blank
DataGrid1.DataSource = null;
DataGrid1.DataBind();
}
....
}
End code
Basically, my question is in reference to the case when the if fails
(if (txtEmployeeID.Text.Length > 0)) and it goes to the else. This
means that I want DataGrid1 totally removed. The above shows up as
'nothing' on the asp.net page, but leaves this blank space. The reason
I see this page is because I have 4 DataGrid's back to back. If the
first 3 DataGrid objects are all set to null (like I have above), and
the DataGrid4 is present, then DataGrid4 has rows to display. On my
asp.net page, I have this huge space where the 3 datagrid's are blank.
That's because on my design view, it shows like this:
ASP.PAGE
Textbox(s)
DataGrid1
DataGrid2
DataGrid3
DataGrid4
I'm wondering if there is a command for the DataGrid to entirely remove
it, so that the space is removed.
Ideally, if the above situation happened, I'd want the DataGrid4 table
to show up right near the top of my page.
Thanks for any comments.
-Dan
Start code...
private void searchBtn_Click(object sender, System.EventArgs e)
{
//For sqlCommand1 is a search by Wkst ID (employeeID on pubs) params
if (txtEmployeeID.Text.Length > 0)
{
sqlCommand1.Parameters["@txtEmployeeID"].Value =
txtEmployeeID.Text;
sqlConnectSMS.Open();
System.Data.SqlClient.SqlDataReader dreader;
dreader = sqlCommand1.ExecuteReader();
DataGrid1.DataSource = dreader;
DataGrid1.DataBind();
dreader.Close();
sqlConnectSMS.Close();
}
else
{
//resets the data source to blank
DataGrid1.DataSource = null;
DataGrid1.DataBind();
}
....
}
End code
Basically, my question is in reference to the case when the if fails
(if (txtEmployeeID.Text.Length > 0)) and it goes to the else. This
means that I want DataGrid1 totally removed. The above shows up as
'nothing' on the asp.net page, but leaves this blank space. The reason
I see this page is because I have 4 DataGrid's back to back. If the
first 3 DataGrid objects are all set to null (like I have above), and
the DataGrid4 is present, then DataGrid4 has rows to display. On my
asp.net page, I have this huge space where the 3 datagrid's are blank.
That's because on my design view, it shows like this:
ASP.PAGE
Textbox(s)
DataGrid1
DataGrid2
DataGrid3
DataGrid4
I'm wondering if there is a command for the DataGrid to entirely remove
it, so that the space is removed.
Ideally, if the above situation happened, I'd want the DataGrid4 table
to show up right near the top of my page.
Thanks for any comments.
-Dan