This post by Fredrik Normén is a big help. I need to create a custom parameter that binds to Context. I was able to create in minutes following the example. The result is:
public class ContextParameter : System.Web.UI.WebControls.Parameter
{
private string _contextField;
public ContextParameter()
{
}
protected ContextParameter(ContextParameter original)
: base(original)
{
this.ContextField = original.ContextField;
}
protected override object Evaluate(HttpContext context, Control control)
{
if (context != null && _contextField != null)
{
return context.Items[_contextField];
}
else
{
return null;
}
}
protected override Parameter Clone()
{
return new ContextParameter(this);
}
public string ContextField
{
get
{
return _contextField;
}
set
{
_contextField = value;
}
}
}I can the use the parameter like:
<dt:ContextParameter Name="PageID" ContextField="PageID" Type="String" DefaultValue="136b08ff-3752-4704-8db8-cf323a98bfaa" />