473,939 Members | 3,075 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing literals with client side script?

Is there any way to access hidden literal controls using client side
script? Can't seem to see them at all in the HTML output.

Nov 19 '05 #1
5 1302
no, when you make some visible=false in your code, it doesn't even arrive
client side.
You want to use an HtmlControl that you can hide, and JavaScript will be
able to see that.

If its not in the HTML output, then JavaScript cannot see it as it doesn't
exist client side

"Chris Ashley" <ch***********@ gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Is there any way to access hidden literal controls using client side
script? Can't seem to see them at all in the HTML output.

Nov 19 '05 #2
Hi Grant,

Thanks for your help on both points. I find that it's difficult trying
to think about a stateless environment in OO terms!

I'm probably using the literal control totally wrong - basically my
page class has 'pageNumber' int which I was populating a hidden literal
with in the hope that I could access it using client side script. Is
there a better alternative? Any way to populate a hidden form field
using server controls?

Thanks,

Chris

Nov 19 '05 #3
yes, if you create a an html control (like say <input> and set its style to
be visibility:hidd en
You can set this control to runat server:

<input type="textbox" id="tb" style="visibili ty:hidden" runat="server"/>

You can now declare this in your code behind and sets its value.
This will also be retrievable through the JavaScript

code behind:
protected System.Web.UI.H tmlControls.Htm lInputText tb;

then
tb.Value = "Your ID Goes here";

this you should now be able to see in your source, but it will be invisible
on the page.

HTH (still pending on your other question .. gotta do my job :))
"Chris Ashley" <ch***********@ gmail.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hi Grant,

Thanks for your help on both points. I find that it's difficult trying
to think about a stateless environment in OO terms!

I'm probably using the literal control totally wrong - basically my
page class has 'pageNumber' int which I was populating a hidden literal
with in the hope that I could access it using client side script. Is
there a better alternative? Any way to populate a hidden form field
using server controls?

Thanks,

Chris

Nov 19 '05 #4
Aha! Didn't realise that was possible at all. Thanks ever so much for
that. :)

Chris

Nov 19 '05 #5
it would be better to use:

<input type=hidden id=tb runat=server>

which was designed for this purpose.

-- bruce (sqlwork.com)
"Grant Merwitz" <gr***@workshar e.com> wrote in message
news:O1******** ******@TK2MSFTN GP09.phx.gbl...
yes, if you create a an html control (like say <input> and set its style
to be visibility:hidd en
You can set this control to runat server:

<input type="textbox" id="tb" style="visibili ty:hidden"
runat="server"/>

You can now declare this in your code behind and sets its value.
This will also be retrievable through the JavaScript

code behind:
protected System.Web.UI.H tmlControls.Htm lInputText tb;

then
tb.Value = "Your ID Goes here";

this you should now be able to see in your source, but it will be
invisible on the page.

HTH (still pending on your other question .. gotta do my job :))
"Chris Ashley" <ch***********@ gmail.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hi Grant,

Thanks for your help on both points. I find that it's difficult trying
to think about a stateless environment in OO terms!

I'm probably using the literal control totally wrong - basically my
page class has 'pageNumber' int which I was populating a hidden literal
with in the hope that I could access it using client side script. Is
there a better alternative? Any way to populate a hidden form field
using server controls?

Thanks,

Chris


Nov 19 '05 #6

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

Similar topics

9
4349
by: Kathryn | last post by:
Hiya I have a problem with using some client side and server side scripting together in an ASP. I'm using VBScript. What I'm trying to achieve is this - - Page loads up and some server side vbscript reads the database and populates a listbox on the page with the first field from each record in the recordset. This works fine. - User selects an option on the listbox and, using the OnChange, I
3
12417
by: Peter | last post by:
Hello, Two newbie questions: 1) I have a javascript file with a function in it. From this function I want to access a variable in another javascript file -which is not inside a function. I have tried many combinations to do this, but has yet to try the right one. How is it done? 2) What kinds of file operations can be done in Javascript (save,
2
12310
by: Brice Laurencin | last post by:
My code is like that : <jsp:useBean id="vConf" type="cat.eur.tb.eleccard.datatypes.Config" scope="session" /> <jsp:useBean id="equNo" type="java.lang.Integer" scope="session" /> <script language="javascript"> function submit_form() { var equ = vConf.getEqu();
18
2116
by: Choxio | last post by:
Using ASP you can access posted form elements. Is it possible to access them from JavaScript? myHTML.htm <form action=myASP.asp> <input type=hidden id=f1 value=val1> <input type=hidden id=f2 value=val2> <input type=submit value="Choose Me"> </form>
5
14759
by: Vinod Kumar | last post by:
Hi All, Can I access a Javascript function written in an ASP.NET from the codebehind (C#) of that page? If yes, kindly give the code snippet to do this. Thanks and Regards Vinod Kumar
5
2464
by: Brian Henry | last post by:
I am trying to add some items to a list box in java script, they add just fine, the values and text are how they should be. The problem though is when I try to access these added items from asp.net they do not show up, If i place a button on the same form that is a server control, click it, i'd expect the lists to be posted back too... but they dont appear to be because the collections for the list boxes were empty, how do you get a list...
4
1198
by: Steve Schroeder | last post by:
See: http://support.microsoft.com/default.aspx?scid=kb;en-us;317719 I can convert the sample code to my needs for the most part, where I'm fuzzy on is: window.parent.frames("bottom").document.forms(0).children("DataGrid1").outer html Now, if I'm working inside a code-behind form, how might I make the same reference, using VB.Net as opposed to the example given, which is in
0
12102
by: sonu | last post by:
I have following client side code which i have used in my asp.net project SummaryFeatured Resources from the IBM Business Values Solution Center WHITEPAPER : CRM Done Right Improve the likelihood of CRM success from less than 20 percent to 60 percent. WHITEPAPER :
3
1582
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 controls, so I use the following statement to access them: Me.Page.FindControl(ControlID) However, this is returning Nothing, even though the control can be accessed in the Load event of the Page containing the control and the validator. I also...
0
10134
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9963
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
11524
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
11109
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
11292
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,...
1
8218
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
6076
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...
0
6297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3502
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.