I am storing DataTable inside "Application Object" in .aspx page:
DataTable dt = new DataTable();
dt.Columns.Add("SenderUser");
dt.Columns.Add("RcvUser");
dt.Columns.Add("Message");
DataRow dr = dt.NewRow();
dr["SenderUser"] = Session["UName"];
dr["Message"] = txtMsg.Text;
foreach (ListItem li in lst_Users.Items)
{
if (li.Selected)
{
dr["RcvUser"] = li.Value;
}
}
Application["Message"] = dt;
I am calling this "Application Object" inside .asmx page:
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string WebMessage()
{
DataTable dt = ((DataTable)HttpContext.Current.Application["Message"]);
}
Now, I want to filter DataTable of .asmx page, based on Receiver user (dr["RcvUser"]) defined in .aspx page
example: I want to filter Datatable based on below condition:
if(dr["RcvUser"] == Session["UserName"])
Please reply how to achieve it. Im using Framework 2.0