The TextBox.Attributes.Add will add the attributes correctly but they will not be XHTML compliant. In order to add XHTML compliant attributes you can use ClientScript.RegisterExpandoAttribute method.
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
BindData();
}
}
private void BindData()
{
ClientScript.RegisterExpandoAttribute("txtName","BehaviorID",String.Empty);
}
The above will add the BehaviorID as a JavaScript property instead of adding attribute directly into the TextBox element.