473,503 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

requestParams lists the name of the controls and not the ID

TS
i am wondering why the name of the controls are listed in parameters of
request object instead of ID. The name always uses the default '$' for
encapsulations and the ID uses '_'. When i use
Page.ClientScript.RegisterHiddenField it renders the same value for name and
id, which is the '_' for both. This is causing my hidden fields to appear in
request context using '_' separators while all other controls use the '$'.

I have a framework of classes that rely on finding the '$' and interpret '_'
differently. Is there any way i can make
Page.ClientScript.RegisterHiddenField use $ for name value and keep ID as
'_'?

what other options do i have?

thanks
Jun 27 '08 #1
4 1243
the browser postbacks the name, not the id of form controls. under w3c rules,
a "$" is not legal character in an id attribute (which is why they are
changed).

..net uses "$" to mark a control as a child control of a naming container.
RegisterHiddenField does not support naming containers, so it makes the name
and id the same. (its just a name/value dictionary so there is nowhere to
store a seperate name/id).

you will have to render the hidden fields yourself if you want them
different. i'd make a custom control that supported a list of hidden fields
(place it right after the form (master page is ideal). then a static method
that located the control, and added a field to the list.
-- bruce (sqlwork.com)
"TS" wrote:
i am wondering why the name of the controls are listed in parameters of
request object instead of ID. The name always uses the default '$' for
encapsulations and the ID uses '_'. When i use
Page.ClientScript.RegisterHiddenField it renders the same value for name and
id, which is the '_' for both. This is causing my hidden fields to appear in
request context using '_' separators while all other controls use the '$'.

I have a framework of classes that rely on finding the '$' and interpret '_'
differently. Is there any way i can make
Page.ClientScript.RegisterHiddenField use $ for name value and keep ID as
'_'?

what other options do i have?

thanks
Jun 27 '08 #2
Hi TS,

Yes, as Bruce has explained. The html form will always post those html
input fields via its "name" attribute. "ID" attribute is not used for
identifying form fields, it is used for client-side script language or DOM
model to reference each html element.

ASP.NET built-in use '$' char as control ID separator (for nested control
hierarchy). Are you adding hiddenfield inside some other control? If you
add it at page's top level, it should not contains such separator char.
Also, so far for the separator char, you can override ASP.NET Control
class's "IdSeparator" property to change it. However, changing it will
cause postback not work and here is a web article mentioned on this:

#The Odyssee of changing the idSeperator in Asp.net 2.0
http://code4ward.net/cs2/blogs/cmn/a...eeOfChangingTh
eIdSeperatorInAspNet2.aspx

Therefore, we should avoid changing this separator if possible.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "TS" <ma**********@nospam.nospam>
Subject: requestParams lists the name of the controls and not the ID
Date: Tue, 3 Jun 2008 08:26:38 -0500
>i am wondering why the name of the controls are listed in parameters of
request object instead of ID. The name always uses the default '$' for
encapsulations and the ID uses '_'. When i use
Page.ClientScript.RegisterHiddenField it renders the same value for name
and
>id, which is the '_' for both. This is causing my hidden fields to appear
in
>request context using '_' separators while all other controls use the '$'.

I have a framework of classes that rely on finding the '$' and interpret
'_'
>differently. Is there any way i can make
Page.ClientScript.RegisterHiddenField use $ for name value and keep ID as
'_'?

what other options do i have?

thanks
Jun 27 '08 #3
TS
thanks all!

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:ZD**************@TK2MSFTNGHUB02.phx.gbl...
Hi TS,

Yes, as Bruce has explained. The html form will always post those html
input fields via its "name" attribute. "ID" attribute is not used for
identifying form fields, it is used for client-side script language or DOM
model to reference each html element.

ASP.NET built-in use '$' char as control ID separator (for nested control
hierarchy). Are you adding hiddenfield inside some other control? If you
add it at page's top level, it should not contains such separator char.
Also, so far for the separator char, you can override ASP.NET Control
class's "IdSeparator" property to change it. However, changing it will
cause postback not work and here is a web article mentioned on this:

#The Odyssee of changing the idSeperator in Asp.net 2.0
http://code4ward.net/cs2/blogs/cmn/a...eeOfChangingTh
eIdSeperatorInAspNet2.aspx

Therefore, we should avoid changing this separator if possible.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
>>From: "TS" <ma**********@nospam.nospam>
Subject: requestParams lists the name of the controls and not the ID
Date: Tue, 3 Jun 2008 08:26:38 -0500
>>i am wondering why the name of the controls are listed in parameters of
request object instead of ID. The name always uses the default '$' for
encapsulations and the ID uses '_'. When i use
Page.ClientScript.RegisterHiddenField it renders the same value for name
and
>>id, which is the '_' for both. This is causing my hidden fields to appear
in
>>request context using '_' separators while all other controls use the '$'.

I have a framework of classes that rely on finding the '$' and interpret
'_'
>>differently. Is there any way i can make
Page.ClientScript.RegisterHiddenField use $ for name value and keep ID as
'_'?

what other options do i have?

thanks

Jun 27 '08 #4
You're welcome TS,

If you have any continuous questions, welcome to post here.

Sincerely,

Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "TS" <ma**********@nospam.nospam>
References: <eH**************@TK2MSFTNGP02.phx.gbl>
<ZD**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: requestParams lists the name of the controls and not the ID
Date: Wed, 4 Jun 2008 09:44:13 -0500
>
thanks all!

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:ZD**************@TK2MSFTNGHUB02.phx.gbl...
>Hi TS,

Yes, as Bruce has explained. The html form will always post those html
input fields via its "name" attribute. "ID" attribute is not used for
identifying form fields, it is used for client-side script language or
DOM
>model to reference each html element.

ASP.NET built-in use '$' char as control ID separator (for nested control
hierarchy). Are you adding hiddenfield inside some other control? If you
add it at page's top level, it should not contains such separator char.
Also, so far for the separator char, you can override ASP.NET Control
class's "IdSeparator" property to change it. However, changing it will
cause postback not work and here is a web article mentioned on this:

#The Odyssee of changing the idSeperator in Asp.net 2.0
http://code4ward.net/cs2/blogs/cmn/a...eeOfChangingTh
>eIdSeperatorInAspNet2.aspx

Therefore, we should avoid changing this separator if possible.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

=
Jun 27 '08 #5

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

Similar topics

10
2155
by: Philippe C. Martin | last post by:
Hi, I'm looking for an easy algorithm - maybe Python can help: I start with X lists which intial sort is based on list #1. I want to reverse sort list #1 and have all other lists sorted...
9
3734
by: Dave H | last post by:
Hello, I have a query regarding definition lists. Is it good practice semantically to use the dt and dd elements to mark up questions and answers in a frequently asked questions list, or FAQ? ...
8
1756
by: worldbadger | last post by:
Hello there, I have a subform that has anywhere from 20-500 ID numbers (unique) listed on it. Each ID is going to be linked to a picture. First off I set up a check for existance of the file;...
0
1722
by: Giulio Santorini | last post by:
Hi, I've got two drop down list controls. When I select a value from the first one I fill the second one. And when I select a value from the second one I would like to fill another control. But...
1
3847
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this...
8
7560
by: Ed Dror | last post by:
Hi there ASP.NET 2.0 VB & SQL Express Lest take Northwind Categories Products as example I create a table that hold these two together and I create a stored procedure like select ProductID,...
16
2573
by: Michael M. | last post by:
How to find the longst element list of lists? I think, there should be an easier way then this: s1 = s2 = s3 = if len(s1) >= len(s2) and len(s1) >= len(s3): sx1=s1 ## s1 ist längster
1
1871
by: AB | last post by:
I am creating a ASP.Net 1.1 (VB) web. I have 2 drop down lists which are independent of each other. Both are filled from a database on the pageload. There is also a search button which searches the...
9
2494
by: dhtml | last post by:
I have written an article "Unsafe Names for HTML Form Controls". <URL: http://jibbering.com/faq/names/ > I would appreciate any reviews, technical or otherwise. Garrett --...
0
7199
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,...
1
6982
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...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5000
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
4667
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
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1501
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
374
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.