473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 5710
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
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
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
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
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
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
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
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
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
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
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.