For example:
protected void dsMates_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
if (Request.Params["classMateId"] != null)
{
int mateId;
if (int.TryParse(Request.Params["classMateId"], out mateId))
{
using (DataClassesPrivateMsgDataContext db = new DataClassesPrivateMsgDataContext())
{
e.Result = db.Classmates.Where(mate => mate.Id == mateId).FirstOrDefault();
}
}
}
}
How does it works you can see here: 11-A