views:

351

answers:

1

I'm trying to add an attribute to a SharePoint web control:

Microsoft.SharePoint.WebControls.BooleanField which basically renders as an html input checkbox control.

How do I add an attribute to this? such as an event?

Normally for an asp.net web control, you can just do:

sampleControl.Attributes.Add("onclick", "alert('test');");

Any Ideas? thanks.

A: 

Attributes attached to an asp.net control don't necessarily get copied to the rendered html control. If setting an attribute on the control doesn't have the desired effect, you'll need to use javascript to find the rendered html control and add the attribute clientside - quite easy with jQuery.

Tom Clarkson