473,657 Members | 2,571 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.ClientScri pt.RegisterHidd enField 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.ClientScri pt.RegisterHidd enField use $ for name value and keep ID as
'_'?

what other options do i have?

thanks
Jun 27 '08 #1
4 1254
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.
RegisterHiddenF ield 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.ClientScri pt.RegisterHidd enField 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.ClientScri pt.RegisterHidd enField 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 "IdSeparato r" 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
eIdSeperatorInA spNet2.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****@microsof t.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**********@n ospam.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
encapsulatio ns and the ID uses '_'. When i use
Page.ClientScr ipt.RegisterHid denField 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.ClientScr ipt.RegisterHid denField 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.comw rote in message
news:ZD******** ******@TK2MSFTN GHUB02.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 "IdSeparato r" 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
eIdSeperatorInA spNet2.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****@microsof t.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**********@n ospam.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
encapsulation s and the ID uses '_'. When i use
Page.ClientSc ript.RegisterHi ddenField 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.ClientSc ript.RegisterHi ddenField 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****@microsof t.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**********@n ospam.nospam>
References: <eH************ **@TK2MSFTNGP02 .phx.gbl>
<ZD************ **@TK2MSFTNGHUB 02.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.comw rote in message
news:ZD******* *******@TK2MSFT NGHUB02.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 "IdSeparato r" 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
>eIdSeperatorIn AspNet2.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****@microsof t.com.

=
Jun 27 '08 #5

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

Similar topics

10
2171
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 accordingly. Any idea is welcome.
9
3745
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? Here is an example of just such a usage: <dl class="faq"> <di>
8
1771
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; Public Function fileexists(Name As String) As Boolean On Error Resume Next Dim temp As String temp = Dir(Name, vbHidden Or vbSystem Or vbArchive Or vbReadOnly)
0
1731
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 after have choose from the first control and filled the second... when I select something from the second control I have not the post back event! I hope to be understandable! I've attached the code that make problems. It's commented in italian so...
1
3857
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 using a GridView that has ViewState enabled, an ObjectDataSource to process the submitted list, textboxes for getting new item data and an add button. Does this approach sound feasible or are there better alternatives? My problem is that I don't...
8
7568
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, ProductName, CategoryID, from tblCategoryProducts Where (CategoryID = @CategoryID)
16
2591
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
1877
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 database based on the 2 drop down list entries. The first entry in each drop down list is "Please Select". What I am trying to do via client side script is to reset the unselected drop down list when the other drop down list selects a new...
9
2504
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 -- comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8730
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7321
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
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 we have to send another system
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.