I have a class (Msg.cs) with below properties:
private string _senderuser;
private string _message;
private string _receiveruser;
public string senderuser
{
get
{
return _senderuser;
}
set
{
_senderuser = value;
}
}
public string message
{
get
{
return _message;
}
set
{
_message = value;
}
}
public string receiveruser
{
get
{
return _receiveruser;
}
set
{
_receiveruser = value;
}
}
I have a MasterPage (Master.master.cs) in which I created above class object, and passed this class into 'Dictionary'.
And in the end 'Dictionary' is passed into 'Application variable'.
As below:
Msg msgObject = new Msg();
msgObject.message = txtMsg.Text;
msgObject.senderuser = m_user.ToString();
foreach (ListItem li in lst_Users.Items)
{
if (li.Selected)
{
msgObject.receiveruser = li.Value;
}
}
Dictionary<int, Msg> obj = new Dictionary<int, Msg>();
obj.Add(i++, msgObject);
Application["Message"] = obj;
Again, I have a .asmx(web service) page in which I want to call same 'Application variable' defined in above Master page and then I want to fetch top 5 records from 'Dictionary' defined in above Master page.
Please reply how to do it.
I am unable to call 'Dictionary' and 'Application variable' of master page into .asmx page
Please reply