473,779 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

inserting data into client script block

Hi-

I understand that the Page class has methods for inserting client script
into the page. I don't want to build my entire client block w/ a
StringBuilder because I only need 1 dynamic variable in the whole block.
So, with that said, here is what I need to do:

<script language="javas cript">

var root = <%=m_root%>;
</script>

in my code behind I have a protected string
protected string m_root = "Some value";

I can't find a way to insert or Response.Write( ) into the client block, it
just renders out my asp script as a string inside the javascript. How do
you do this? I thought it would be easy, but it's escaping me at this time.

Thanks,
Steve
Nov 18 '05 #1
3 1952
nevermind, I'm crazy. Sorry for the dumb post ;)
"sklett" <as**@fkd.com > wrote in message
news:ep******** ******@TK2MSFTN GP12.phx.gbl...
Hi-

I understand that the Page class has methods for inserting client script
into the page. I don't want to build my entire client block w/ a
StringBuilder because I only need 1 dynamic variable in the whole block.
So, with that said, here is what I need to do:

<script language="javas cript">

var root = <%=m_root%>;
</script>

in my code behind I have a protected string
protected string m_root = "Some value";

I can't find a way to insert or Response.Write( ) into the client block, it
just renders out my asp script as a string inside the javascript. How do
you do this? I thought it would be easy, but it's escaping me at this time.
Thanks,
Steve

Nov 18 '05 #2
Good, because I was about to tell you that it worked fine for me :) Though
I would be interested in knowing how to do that from a codebehind and not
using <%= %>

"sklett" <as**@fkd.com > wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
nevermind, I'm crazy. Sorry for the dumb post ;)
"sklett" <as**@fkd.com > wrote in message
news:ep******** ******@TK2MSFTN GP12.phx.gbl...
Hi-

I understand that the Page class has methods for inserting client script
into the page. I don't want to build my entire client block w/ a
StringBuilder because I only need 1 dynamic variable in the whole block.
So, with that said, here is what I need to do:

<script language="javas cript">

var root = <%=m_root%>;
</script>

in my code behind I have a protected string
protected string m_root = "Some value";

I can't find a way to insert or Response.Write( ) into the client block, it just renders out my asp script as a string inside the javascript. How do you do this? I thought it would be easy, but it's escaping me at this

time.

Thanks,
Steve


Nov 18 '05 #3
I'm using an ASP:Literal control. I wanted to use <%=%> but because I'm
using MasterPages, I need to use the literal.

Basically it's like this
asp:Literal id="Literal_Roo t" runat="server" />

then in the code behind, assuming that you have a MasterPage control named
MasterPage1

((Literal)Maste rPage1.FindCont rol("Literal_Ro ot")).Text = "Some Data";
"Michael Ramey" <raterus@localh ost> wrote in message
news:uh******** ******@TK2MSFTN GP10.phx.gbl...
Good, because I was about to tell you that it worked fine for me :) Though I would be interested in knowing how to do that from a codebehind and not
using <%= %>

"sklett" <as**@fkd.com > wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
nevermind, I'm crazy. Sorry for the dumb post ;)
"sklett" <as**@fkd.com > wrote in message
news:ep******** ******@TK2MSFTN GP12.phx.gbl...
Hi-

I understand that the Page class has methods for inserting client script into the page. I don't want to build my entire client block w/ a
StringBuilder because I only need 1 dynamic variable in the whole block. So, with that said, here is what I need to do:

<script language="javas cript">

var root = <%=m_root%>;
</script>

in my code behind I have a protected string
protected string m_root = "Some value";

I can't find a way to insert or Response.Write( ) into the client
block,
it just renders out my asp script as a string inside the javascript. How do you do this? I thought it would be easy, but it's escaping me at this

time.

Thanks,
Steve



Nov 18 '05 #4

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

Similar topics

7
3800
by: Rainmaker | last post by:
Greetings, I have not been able to find the documentation that will allow me to insert php code inside the html code in the $message block in the mail() function. Using the example in the help file: <?php /* recipients */ $to = "valid@email.add" . ", " ; // note the comma $to .= $_POST;
2
3089
by: Citoyen du Monde | last post by:
Trying to get some ideas on a simple javascript project (to teach myself the language). I want to develop a client-side vocabulary practice application that would allow users to enter their own words, their own definitions plus an example of how the word is used in practice. It'll be all client side with - cookies? to get persistence so that the words won't disappear on me each time the page is closed (which is what happened when I
10
2908
by: Noozer | last post by:
Below is some ASP, HTML and javascript. It is part of a page used to maintain a small database. This code did work at one time, but has since stopped. For some reason the data on my form is not being passed to the page specified in the Action property of the form. This is on a Windows 2000 Pro PC. I copied the code to another server (Windows XP Pro machine) and it DOES work as expected there. The first block is the data located near...
0
913
by: zhimin | last post by:
Hi, I'm writing a program to send large file(100m) through dotnet using TCPListener & TCPClient, I'm sending the file with a ask and response loop: 1. Client send a flag 1 to server indicate it has data send to server. 2. Client send the buffer block size. 3. Client send the actual buffer to the server. 4. Server send a flag 1 to client indicating that the buffer has been successfully receeived. 5. The next loop until all data of the...
1
1997
by: Kevin | last post by:
Hello experts, I'm a newbee to ASP.NET. And I have been struggling solving this problem. But I can't do it. Can you please help me get over this wall? Below is the code and error message: <%@ Page Language="vb" AutoEventWireup="true" Codebehind="RegisterForm.aspx.vb" Inherits="WebApplication1.RegisterForm"%> <%@ import Namespace="System.data.oledb" %>
4
1143
by: Bruno Alexandre | last post by:
Hi guys, I have a web application that insert Clients info into the Database, the Apllication is accesed by several user at the same time, the Client Info is divide by 3 tables (Client, Product and 1 that combine the Client and Product and having all info for how the client bought the product) My question is: HOW can I know for sure that the script is not accesed by 2 diferent users?
5
2224
by: Alex Maghen | last post by:
I frequently find myself wanting to insert some basic client-side JavaScript functions in the page of an ASPX of mine. But I find it so frustrating that I have to actually contruct my JavaScript in C# on the server-side and render it to the client because I can't use the IDs of my controls as they are written in the HTML page itself. Rather, I have to use Control.ClientID to get that ID that I can use in the client-side JS. So my...
4
2296
by: Thomas Eichner | last post by:
Hi, does anybody know a public website which offers a service that displays all data send by a browser (or an app calling the website), especially HTTP GET and POST data, browser data etc.? I have a hard time finding what really my app is sending and this would be a great help! Thank you very much ! Thomas
2
4379
by: Slain | last post by:
I have a big list of HTML files, which need to be updated with a common text. <script language=JavaScript src="./highlight.js"></script> I need to add the above line in each of the html files, before the text "<\head>". All the HTML files have this text and I think some kind of search on this string and either replacing "</head>" with the
0
9636
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
9474
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
10306
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
10138
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...
0
8961
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
7485
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
5373
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...
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
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.