Content page to Master page communication

One way of Content page to Master page communication is having properties or methods in master page and call them form content page.
Simply add @ Master Type directive in content (.aspx) page and mention virtual path to your master page

<%@ MasterType VirtualPath="~/MailBox/ThenMail.master"%> 

Above line will create a strongly typed reference to master page and by using Master property we can access methods and properties of master page in content page.

Here I am declaring a property in my master page’s cs class:

public bool MailBoxVisibility 
 lbtnMailBox .Visible = value; 

Now see how easily we can access this property in  content page .cs class.

Master.MailBoxVisibility = false; lbtnMailBox .Visible = value; 

Selecting rows from DataTable without using Linq

DataRow(s) from DataTable can be selected without LINQ just by using DataTable.Select() method.

string searchExpression = null; 
searchExpression = "CategoryId=" + 2; 
DataRow[] SelectedDataRows = EmailAttachment.Select(searchExpression);

SelectedDataRows will have all rows where CategoryID is 2. An overload of Select also allows to select and sort results, for more details on it

please see

How to get current page URL ?

Request.Url will return current page URL.