I want to combine a textbox and several validator controls into 1 usercontrol.
Is this possible with the intent to keep some fields dynamic like
textbox:cssclass
textbox:id
textbox:width
I’m asking this because i find myself putting a lot of validator controls
for every (same textbox type) field in my form and it’s getting kinda messy.
Kind regards,
Mark
Build your usercontrol with properties that pass through to the textboxes. So for example, you’d include your ascx like:
In the code for your user control, simply create these properties:
And in the code somewhere, pass the properties through to your textbox control. PreRender would be a good place to do it.
where myTextControl is the textbox that your usercontrol contains.