473,511 Members | 16,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

invalid characters in 'ID' web control property

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
Nov 18 '05 #1
1 5731
Gabe, I don't know if there is a list of characters or a function to strip them, but I'd be very nervous about using *data* to create any sort of ID field. I understand wanting to access them later, but can't you use a column name or something you "trust"? Otherwise, even if there is a strip function you trust, you'll run the risk of two different data fields "stripping" to the same ID. Just my $.02.

----- Gabe Moothart wrote: -----

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

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
8134
by: Safalra | last post by:
The idea here is relatively simple: a java program (I'm using JDK1.4 if that makes a difference) that loads an HTML file, removes invalid characters (or replaces them in the case of common ones...
0
1823
by: Felix Natter | last post by:
hello, I am getting this error with php 4.4.0 (cgi mode), apache 1.3.26 on debian woody: PHP Warning: session_start(): The session id contains invalid characters, valid characters are only...
6
13578
by: TS | last post by:
Hi, i have a problem validating xml against schema. I used http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx validator and it says it is fine. Can you tell me why this doesn't work? ...
3
343
by: Gabe Moothart | last post by:
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,...
1
2763
by: alex | last post by:
Hi, when building a new project i get the following errors Invalid language characters in property 'Depenendencies' Invalid language characters in property 'Files' It all points to...
1
1812
by: Niclas | last post by:
Hi, How do I indicate what field fails a validation, usually you see a red star next to the faild field on a form. Is this built in functionality in the valdaition controls or shall I code this...
11
11099
by: Ron L | last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the data it scans comes through as if it was typed on a keyboard. I am trying to have the data in the barcode be displayed in...
5
6849
by: jason.neo | last post by:
Hi all experts, I am going nuts with this Invalid postback or callback argument thingy with .Net 2.0 I am building a file attachment module which relays on a Datatable stored in session (yeah...
1
2792
by: eBob.com | last post by:
I have some code which is trying to determine where text will wrap in a custom text box (which Inherits from Control). It determines the number of characters which will fit in the first line, but...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7423
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.