473,378 Members | 1,134 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,378 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 5720
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.