T
timpera2501
I've been working on this same problem for 2 full workdays now and I'm about
ready to tear my hair out. Please! If anyone knows the answer, please
respond.
Very simply, I have a BusinessLayer bound to an ObjectDataSource called
"ObjectDataSourceEmergencyTTs". The value passed to
"ObjectDataSourceEmergencyTTs" will always be a single integer.
If that value is "0", I want a formview control called "EmergencyTTs" to NOT
display.
The code I have written to try and accomplish this is located in the
"Page_Onload" event as follows:
*************************
DataSet ds = ObjectDataSourceEmergencyTTs.Select() as DataSet;
string EMTs =
ds.Tables["EmergencyTTsCount"].Rows[0]["COUNT"].ToString();
if (String.Equals(EMTs, "0"))
{
EmergencyTTs.Visible = false;
}
else
{
EmergencyTTs.Visible = true;
OTHER.Text = EMTs;
}
****************************
The problem is that
"ds.Tables["EmergencyTTsCount"].Rows[0]["COUNT"].ToString();" always returns
null!
However, I know that the value is not null because I have a Label control
within the Formview that displays that value, and it is never null.
I have tried putting this same code in the DataBinding method for both the
ObjectDataSource and the Formview with no change.
Can anyone tell me what I am doing wrong, please?
ready to tear my hair out. Please! If anyone knows the answer, please
respond.
Very simply, I have a BusinessLayer bound to an ObjectDataSource called
"ObjectDataSourceEmergencyTTs". The value passed to
"ObjectDataSourceEmergencyTTs" will always be a single integer.
If that value is "0", I want a formview control called "EmergencyTTs" to NOT
display.
The code I have written to try and accomplish this is located in the
"Page_Onload" event as follows:
*************************
DataSet ds = ObjectDataSourceEmergencyTTs.Select() as DataSet;
string EMTs =
ds.Tables["EmergencyTTsCount"].Rows[0]["COUNT"].ToString();
if (String.Equals(EMTs, "0"))
{
EmergencyTTs.Visible = false;
}
else
{
EmergencyTTs.Visible = true;
OTHER.Text = EMTs;
}
****************************
The problem is that
"ds.Tables["EmergencyTTsCount"].Rows[0]["COUNT"].ToString();" always returns
null!
However, I know that the value is not null because I have a Label control
within the Formview that displays that value, and it is never null.
I have tried putting this same code in the DataBinding method for both the
ObjectDataSource and the Formview with no change.
Can anyone tell me what I am doing wrong, please?