views:

19

answers:

1

Hello

I've a requirement where i need to pass some objects across the pages. So i created a custom class with all the properties required and created a instance of it and assigned all the properties appropriately. I then put that object in the session and took it the other page.

The problem is that even when i set the properties values to the class it is coming as null. I set a breakpoint in the getter-setter and saw that the value itself is coming as null.

Code -

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;
        }
    }
}

This is how i'm creating an instance in the page1 and trying to get it in the page2.

Page1 Code

//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();

But the values are not getting set at all. The values are not passing to the class (to the setter) at all. Am i making any OOP blunder?

Any ideas?

NLV

A: 

Stupid and silly. It has to be 'value' instead of the public variable in the setter.

NLV
But can anyone tell me what is 'value'?
NLV
@NLV - Can't you just edit your question instead of adding information as an answer? This is not an answer, so don't add it as one.
Oded
Sorry. So what should be the answer?
NLV