473,404 Members | 2,170 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,404 software developers and data experts.

Accessing server controls using client scripts....

Stu
Hi,

I am migrating a large app to .Net 2 and am having problems with accessing
hidden fields using javascript.

As I am using masterpages the control names are prefixed with the control
reference of the masterpage '_ctl0_cphMain_MyHiddenField' etc. The app uses
dynamically assigned masterpages to the control name on the page changes
depending on the masterpage being used. There is no

Is there any way of specifying a clientside name to a hidden field, or
adding the additional string to the script automatically?

Thanks in advance,
Stu
Dec 16 '05 #1
2 1640
Have you tried dynamicly generating your script, using the ClientId property
of the controls to get the ids for the hidden fields?

"Stu" wrote:
Hi,

I am migrating a large app to .Net 2 and am having problems with accessing
hidden fields using javascript.

As I am using masterpages the control names are prefixed with the control
reference of the masterpage '_ctl0_cphMain_MyHiddenField' etc. The app uses
dynamically assigned masterpages to the control name on the page changes
depending on the masterpage being used. There is no

Is there any way of specifying a clientside name to a hidden field, or
adding the additional string to the script automatically?

Thanks in advance,
Stu

Dec 16 '05 #2
In ASP.NET 2.0, you shoud use the functions placed in Page.ClientScript to
register scripts or hidden fields in the page. In the previous version of
ASP.NET theses functions where placed directly on the Page object.
In your example, you can use the folowing statement to register your hidden
field from a UserControl, the Page or from the MasterPage. The client ID of
the field will be preserved with this method :)

Page.ClientScript.RegisterHiddenField("MyHiddenFie ld", "default value");

--
Daniel TIZON
MCP - MCSD.NET - MCT
"David Jessee" <Da*********@discussions.microsoft.com> a écrit dans le
message de news: 32**********************************@microsoft.com...
Have you tried dynamicly generating your script, using the ClientId
property
of the controls to get the ids for the hidden fields?

"Stu" wrote:
Hi,

I am migrating a large app to .Net 2 and am having problems with
accessing
hidden fields using javascript.

As I am using masterpages the control names are prefixed with the control
reference of the masterpage '_ctl0_cphMain_MyHiddenField' etc. The app
uses
dynamically assigned masterpages to the control name on the page changes
depending on the masterpage being used. There is no

Is there any way of specifying a clientside name to a hidden field, or
adding the additional string to the script automatically?

Thanks in advance,
Stu

Dec 16 '05 #3

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

Similar topics

2
by: Douglas Harber | last post by:
If I have DB2 8.1 (FP5, I believe, but not relevant to my question...I hope) installed on my desktop, do I have what I need to connect to a remote DB2 server (also running 8.1 FP5) from my desktop...
4
by: earwicker | last post by:
I recently deployed a web application which contains a user registration form with the usual fields: name, address, email, password, etc. Each of the TextBoxes uses a validation control to verify...
5
by: Mong | last post by:
Hi, I have a webform with various asp controls on it such as textboxes and dropdownlists. I'm fairly new to asp.net coming from VB6 and am wondering when it's best to use client side events and...
1
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
8
by: | last post by:
How can I access web-services through client browser's java-scripts? Every comment is appreciated, Jamal
9
by: CGW | last post by:
I asked the question yesterday, but know better how to ask it, today: I'm trying to use the File.Copy method to copy a file from a client to server (.Net web app under IIS ). It looks to me that...
10
by: Ben | last post by:
Hi, I made an application in classic asp (reservation of books and video stuffs for students) and want to migrate to asp.net. The user has to chose a date, then pushung on a submit button. The...
3
by: Nathan Sokalski | last post by:
I have a validator that I wrote by inheriting from BaseValidator. At certain points in the code, I need to access other controls on the page containing the validator. I have the IDs of these...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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
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,...
0
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...
0
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
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,...

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.