У меня есть требование, где мне нужно передать некоторые объекты на страницах. Поэтому я создал пользовательский класс со всеми необходимыми свойствами, создал его экземпляр и назначил все свойства соответствующим образом. Затем я поместил этот объект в сеанс и перенес его на другую страницу.
Проблема в том, что даже когда я устанавливаю значения свойств для класса, он становится равным нулю. Я установил точку останова в getter-setter и увидел, что само значение равно нулю.
Код -
public class GetDataSetForReports
{
private Table m_aspTable;
private int m_reportID;
private string m_accountKey;
private string m_siteKey;
private string m_imUserName;
/// <summary>
/// Asp Table containing the filters
/// </summary>
public Table aspTable
{
get
{
return m_aspTable;
}
set
{
m_aspTable = aspTable;
}
}
/// <summary>
/// Report ID
/// </summary>
public int reportID
{
get
{
return m_reportID;
}
set
{
m_reportID = reportID;
}
}
/// <summary>
/// All the accounts selected
/// </summary>
public string accountKey
{
get
{
return m_accountKey;
}
set
{
m_accountKey = accountKey;
}
}
/// <summary>
/// All the sites selected
/// </summary>
public string siteKey
{
get
{
return m_siteKey;
}
set
{
m_siteKey = siteKey;
}
}
/// <summary>
/// Current User Name
/// </summary>
public string imUserName
{
get
{
return m_imUserName;
}
set
{
m_imUserName = imUserName;
}
}
}
Вот как я создаю экземпляр на странице1 и пытаюсь получить его на странице2.
Код страницы
//Add the objects to the GetDataSetForReports Class
GetDataSetForReports oGetDSForReports = new GetDataSetForReports();
oGetDSForReports.aspTable = aspTable;
oGetDSForReports.reportID = iReportID;
oGetDSForReports.accountKey = AccountKey;
oGetDSForReports.siteKey = Sitekey;
oGetDSForReports.imUserName = this.imUserName.ToString();
Но значения не устанавливаются вообще. Значения не передаются классу (установщику) вообще. Я делаю какие-либо ошибки ООП?
Есть идеи?
NLV