Mega Code Archive
Creating Custom Parameter Objects
File: UsernameParameter.cs
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MyControls
{
public class UsernameParameter : Parameter
{
protected override object Evaluate(HttpContext context, Control control)
{
if (context != null)
return context.User.Identity.Name;
else
return null;
}
}
}
File: Default.aspx
<%@ Page Language="C#" %>
<%@ Register TagPrefix="custom" Namespace="MyControls" %>
Show Username Parameter