G
Gabe Moothart
Hi,
In my asp.net app, I create several controls dynamically, and set their
'ID' property to a value stored in a database, so I can reference them
later. So far so good.
This database field, however, might contain characters which are illegal
in the 'ID' property. It took me quite a while to figure out that the
reason one of my controls was not working (but the others were) was
because there was a ':' in the ID property. Apparently, instead of
raising an exception (which I would have preferred), asp.net silently
converted the ':' to '_' - changing the name of my component.
After some experimentation, I noticed that, in the property editor, an
exception is raised when I try to create an ID field with any of the
characters '-', ':', and '?' (I'm sure there are others, too). However,
when setting the ID property at runtime, '-' and '?' are passed through
unchanged, and seem to work; while ':' is converted to '_'.
Is there a list somewhere of characters I need to avoid in the 'ID'
attribute? Or, better yet, a function which strips them out of a string?
TIA,
Gabe
In my asp.net app, I create several controls dynamically, and set their
'ID' property to a value stored in a database, so I can reference them
later. So far so good.
This database field, however, might contain characters which are illegal
in the 'ID' property. It took me quite a while to figure out that the
reason one of my controls was not working (but the others were) was
because there was a ':' in the ID property. Apparently, instead of
raising an exception (which I would have preferred), asp.net silently
converted the ':' to '_' - changing the name of my component.
After some experimentation, I noticed that, in the property editor, an
exception is raised when I try to create an ID field with any of the
characters '-', ':', and '?' (I'm sure there are others, too). However,
when setting the ID property at runtime, '-' and '?' are passed through
unchanged, and seem to work; while ':' is converted to '_'.
Is there a list somewhere of characters I need to avoid in the 'ID'
attribute? Or, better yet, a function which strips them out of a string?
TIA,
Gabe