473,385 Members | 1,337 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,385 software developers and data experts.

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="javascript">

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 1937
nevermind, I'm crazy. Sorry for the dumb post ;)
"sklett" <as**@fkd.com> wrote in message
news:ep**************@TK2MSFTNGP12.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="javascript">

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******************@TK2MSFTNGP09.phx.gbl...
nevermind, I'm crazy. Sorry for the dumb post ;)
"sklett" <as**@fkd.com> wrote in message
news:ep**************@TK2MSFTNGP12.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="javascript">

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_Root" runat="server" />

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

((Literal)MasterPage1.FindControl("Literal_Root")) .Text = "Some Data";
"Michael Ramey" <raterus@localhost> wrote in message
news:uh**************@TK2MSFTNGP10.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******************@TK2MSFTNGP09.phx.gbl...
nevermind, I'm crazy. Sorry for the dumb post ;)
"sklett" <as**@fkd.com> wrote in message
news:ep**************@TK2MSFTNGP12.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="javascript">

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
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...
2
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...
10
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...
0
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...
1
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: <%@...
4
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...
5
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...
4
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...
2
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.