Mark,
Your dataset is null...you never do _Employee = new DataSet()...The simplest
way to solve your problem:
private DataSet _Employee = new DataSet(); //instead of = null;
The reason no on suggested this is that declaring a dataset in a page and
populating it in a user-control isn't obvious (at best) and suspect (at
worst). I would consider examining if that's a sound architecture. Since
I'm not sure what you are trying to do, short of your initial post asking
how to make a variable visible to all user controls, I can't offer any
suggestions.
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
After all here is what I have:
in Webform (main2):
private DataSet _Employee = null;
public DataSet Employee
{
get
{return _Employee;}
set
{_Employee = value;}
}
in the user control:
DataSet ds = ((humanres.main2)Page).Employee;
....
SqlHelper.FillDataset(conn, CommandType.Text, "select * from
udf_getEmployeeDetails(" + EmployeeId + ")",
ds, new string[]{"employee"});
fails with the following error:
Server Error in '/humanres' Application.
Value cannot be null. Parameter name: dataSet
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: dataSet
Line 53: DataSet ds = ((humanres.main2)Page).Employee;
.....
Line 55: SqlHelper.FillDataset(conn, CommandType.Text, "select * from
udf_getEmployeeDetails(" + EmployeeId + ")",
Line 56: ds, new string[]{"employee"});