I am trying to add a custom data-required attribute to an asp Checkbox control, it works fine for all other controls I've used it on, but on checkboxs it renders the checkbox inside a span that has the custom attribute on. I've tried adding the attribute in the markup and tried adding it to the control in the code behind. Any ideas?
-
Wow, that is a bummer ... if it's just rendering like that, I'm inclined to think you might have to re-write the control, or at least override its "Render" method or something. Have you considered a client-side hack, adding the attribute by Javascript after the page loads?McGarnagle– McGarnagle2012-03-30 08:22:33 +00:00Commented Mar 30, 2012 at 8:22
-
@dbaseman CheckBox control has collections for adding attributes to the rendered span and for the rendered input alsoAdrian Iftode– Adrian Iftode2012-03-30 08:27:37 +00:00Commented Mar 30, 2012 at 8:27
-
@AdrianIftode nice! Good thing I don't work for tom, eh?McGarnagle– McGarnagle2012-03-30 08:29:29 +00:00Commented Mar 30, 2012 at 8:29
-
1That's worked great, thanks! I didn't think it should be difficult, I hoped was just missing something.Tom Riley– Tom Riley2012-03-30 08:34:32 +00:00Commented Mar 30, 2012 at 8:34
Add a comment
|