I saw some web page saying I could do it this way in
javascript:
var iNumber = <%#publicvarnam e [or] publicpropertyn ame %>
but it doesn't seem to work. I have this piece of code
here in javascript:
<script language="javas cript">
var sessionServer = "<%#jsTestServe r%>";
alert(sessionSe rver);
</script>
and the variable is defined in the C# code behind:
public string jsTestServer
= "\\\\TestServer \\TestSession\\ ";
when I run it, alert has no message in it. 8 4824
"Jade" <an*******@disc ussions.microso ft.com> wrote in
news:12******** *************** *****@phx.gbl: I saw some web page saying I could do it this way in javascript: var iNumber = <%#publicvarnam e [or] publicpropertyn ame %>
but it doesn't seem to work. I have this piece of code here in javascript: <script language="javas cript"> var sessionServer = "<%#jsTestServe r%>"; alert(sessionSe rver); </script>
and the variable is defined in the C# code behind: public string jsTestServer = "\\\\TestServer \\TestSession\\ ";
when I run it, alert has no message in it.
Jade,
Try <%= jsTestServer %> instead of <%# jsTestServer %>.
Hope this helps.
Chris.
-------------
C.R. Timmons Consulting, Inc. http://www.crtimmonsinc.com/
<%# is the DataBinding syntax. You need to make sure you call DataBind() on
your page (in the server code. You can also use <%=someVariable %>, which
will print the value out when it runs. The DataBind way is a little more
elegant, I feel.
-mike
MVP
"Jade" <an*******@disc ussions.microso ft.com> wrote in message
news:12******** *************** *****@phx.gbl.. . I saw some web page saying I could do it this way in javascript: var iNumber = <%#publicvarnam e [or] publicpropertyn ame %>
but it doesn't seem to work. I have this piece of code here in javascript: <script language="javas cript"> var sessionServer = "<%#jsTestServe r%>"; alert(sessionSe rver); </script>
and the variable is defined in the C# code behind: public string jsTestServer = "\\\\TestServer \\TestSession\\ ";
when I run it, alert has no message in it.
It still doesn't work. Here is exactly what I have now:
<script language="javas cript">
var sessionServer = "<%=jsTestServe r%>";
alert(sessionSe rver);
function CreateSessionFl ag()
{
alert("hello");
}
function DeleteSessionFl ag()
{
alert("bye");
}
</script>
</head>
<body MS_POSITIONING= "GridLayout "
onLoad="CreateS essionFlag();">
In the C# code behind:
public class WebForm1 : System.Web.UI.P age
{
public string jsTestServer
= "\\\\ze483z\\Te stSession\\";
private void Page_Load(objec t sender, System.EventArg s
e)
{ // Put user code to initialize the page here }
It's a very simple test program. After I changed to "<%
=jsTestServer%> ", it generates some jscript error -
object expected on the "onload" line. If I used the old
way var sessionServer = "<%#jsTestServe r%>"; it pops up
an alert with empty message. -----Original Message----- <%# is the DataBinding syntax. You need to make sure
you call DataBind() onyour page (in the server code. You can also use <%
=someVariable%> , whichwill print the value out when it runs. The DataBind way
is a little moreelegant, I feel.
-mike MVP
"Jade" <an*******@disc ussions.microso ft.com> wrote in
messagenews:12******* *************** ******@phx.gbl. .. I saw some web page saying I could do it this way in javascript: var iNumber = <%#publicvarnam e [or] publicpropertyn ame
%> but it doesn't seem to work. I have this piece of code here in javascript: <script language="javas cript"> var sessionServer = "<%#jsTestServe r%>"; alert(sessionSe rver); </script>
and the variable is defined in the C# code behind: public string jsTestServer = "\\\\TestServer \\TestSession\\ ";
when I run it, alert has no message in it.
.
Check out HTML output. If you have \\ characters, they will get interpreted
by C#. Try with your variable as "Hello, JScript!" :).
Using the <%# syntax, did you do a this.DataBind() ; call in your OnLoad or
somewhere?
-mike
MVP
<an*******@disc ussions.microso ft.com> wrote in message
news:14******** *************** *****@phx.gbl.. . It still doesn't work. Here is exactly what I have now:
<script language="javas cript"> var sessionServer = "<%=jsTestServe r%>"; alert(sessionSe rver);
function CreateSessionFl ag() { alert("hello"); }
function DeleteSessionFl ag() { alert("bye"); } </script> </head> <body MS_POSITIONING= "GridLayout " onLoad="CreateS essionFlag();">
In the C# code behind: public class WebForm1 : System.Web.UI.P age { public string jsTestServer = "\\\\ze483z\\Te stSession\\";
private void Page_Load(objec t sender, System.EventArg s e) { // Put user code to initialize the page here }
It's a very simple test program. After I changed to "<% =jsTestServer%> ", it generates some jscript error - object expected on the "onload" line. If I used the old way var sessionServer = "<%#jsTestServe r%>"; it pops up an alert with empty message.
-----Original Message----- <%# is the DataBinding syntax. You need to make sure you call DataBind() onyour page (in the server code. You can also use <% =someVariable%> , whichwill print the value out when it runs. The DataBind way is a little moreelegant, I feel.
-mike MVP
"Jade" <an*******@disc ussions.microso ft.com> wrote in messagenews:12******* *************** ******@phx.gbl. .. I saw some web page saying I could do it this way in javascript: var iNumber = <%#publicvarnam e [or] publicpropertyn ame %> but it doesn't seem to work. I have this piece of code here in javascript: <script language="javas cript"> var sessionServer = "<%#jsTestServe r%>"; alert(sessionSe rver); </script>
and the variable is defined in the C# code behind: public string jsTestServer = "\\\\TestServer \\TestSession\\ ";
when I run it, alert has no message in it.
.
It did interpreted correctly in HTML:
var sessionServer = "\\ze483z\TestS ession\";
where/how should I use "this.DataBind( );" exactly in
Onload??? -----Original Message----- Check out HTML output. If you have \\ characters, they
will get interpretedby C#. Try with your variable as "Hello, JScript!" :).
Using the <%# syntax, did you do a this.DataBind() ; call
in your OnLoad orsomewhere?
-mike MVP
<an*******@dis cussions.micros oft.com> wrote in message news:14******* *************** ******@phx.gbl. .. It still doesn't work. Here is exactly what I have
now: <script language="javas cript"> var sessionServer = "<%=jsTestServe r%>"; alert(sessionSe rver);
function CreateSessionFl ag() { alert("hello"); }
function DeleteSessionFl ag() { alert("bye"); } </script> </head> <body MS_POSITIONING= "GridLayout " onLoad="CreateS essionFlag();">
In the C# code behind: public class WebForm1 : System.Web.UI.P age { public string jsTestServer = "\\\\ze483z\\Te stSession\\";
private void Page_Load(objec t sender,
System.EventArg s e) { // Put user code to initialize the page here }
It's a very simple test program. After I changed
to "<% =jsTestServer%> ", it generates some jscript error - object expected on the "onload" line. If I used the
old way var sessionServer = "<%#jsTestServe r%>"; it pops up an alert with empty message.
>-----Original Message----- ><%# is the DataBinding syntax. You need to make sure you call DataBind() on >your page (in the server code. You can also use <% =someVariable%> , which >will print the value out when it runs. The DataBind
way is a little more >elegant, I feel. > >-mike >MVP > >"Jade" <an*******@disc ussions.microso ft.com> wrote in message >news:12******* *************** ******@phx.gbl. .. >> I saw some web page saying I could do it this way in >> javascript: >> var iNumber = <%#publicvarnam e [or]
publicpropertyn ame %> >> >> but it doesn't seem to work. I have this piece of
code >> here in javascript: >> <script language="javas cript"> >> var sessionServer = "<%#jsTestServe r%>"; >> alert(sessionSe rver); >> </script> >> >> and the variable is defined in the C# code behind: >> public string jsTestServer >> = "\\\\TestServer \\TestSession\\ "; >> >> when I run it, alert has no message in it. > > >. >
.
> It did interpreted correctly in HTML: var sessionServer = "\\ze483z\TestS ession\";
Right, and that's not valid for JScript, thus the runtime error.
where/how should I use "this.DataBind( );" exactly in Onload???
this.DataBind() ; // That's it
That binds all the <%# markers.
-mike
MVP -----Original Message----- Check out HTML output. If you have \\ characters, they will get interpretedby C#. Try with your variable as "Hello, JScript!" :).
Using the <%# syntax, did you do a this.DataBind() ; call in your OnLoad orsomewhere?
-mike MVP
<an*******@dis cussions.micros oft.com> wrote in message news:14******* *************** ******@phx.gbl. .. It still doesn't work. Here is exactly what I have now: <script language="javas cript"> var sessionServer = "<%=jsTestServe r%>"; alert(sessionSe rver);
function CreateSessionFl ag() { alert("hello"); }
function DeleteSessionFl ag() { alert("bye"); } </script> </head> <body MS_POSITIONING= "GridLayout " onLoad="CreateS essionFlag();">
In the C# code behind: public class WebForm1 : System.Web.UI.P age { public string jsTestServer = "\\\\ze483z\\Te stSession\\";
private void Page_Load(objec t sender, System.EventArg s e) { // Put user code to initialize the page here }
It's a very simple test program. After I changed to "<% =jsTestServer%> ", it generates some jscript error - object expected on the "onload" line. If I used the old way var sessionServer = "<%#jsTestServe r%>"; it pops up an alert with empty message.
>-----Original Message----- ><%# is the DataBinding syntax. You need to make sure you call DataBind() on >your page (in the server code. You can also use <% =someVariable%> , which >will print the value out when it runs. The DataBind way is a little more >elegant, I feel. > >-mike >MVP > >"Jade" <an*******@disc ussions.microso ft.com> wrote in message >news:12******* *************** ******@phx.gbl. .. >> I saw some web page saying I could do it this way in >> javascript: >> var iNumber = <%#publicvarnam e [or] publicpropertyn ame %> >> >> but it doesn't seem to work. I have this piece of code >> here in javascript: >> <script language="javas cript"> >> var sessionServer = "<%#jsTestServe r%>"; >> alert(sessionSe rver); >> </script> >> >> and the variable is defined in the C# code behind: >> public string jsTestServer >> = "\\\\TestServer \\TestSession\\ "; >> >> when I run it, alert has no message in it. > > >. >
.
I'm sorry, Mike. I still don't know where to
put "this.DataBind( );" I put it in
private void Page_Load(objec t sender, System.EventArg s e)
{
this.DataBind() ;
}
and I still have the runtime error. -----Original Message----- It did interpreted correctly in HTML: var sessionServer = "\\ze483z\TestS ession\"; Right, and that's not valid for JScript, thus the
runtime error. where/how should I use "this.DataBind( );" exactly in Onload???
this.DataBind( ); // That's it
That binds all the <%# markers.
-mike MVP
>-----Original Message----- >Check out HTML output. If you have \\ characters,
they will get interpreted >by C#. Try with your variable as "Hello,
JScript!" :). > >Using the <%# syntax, did you do a this.DataBind() ;
call in your OnLoad or >somewhere? > >-mike >MVP > ><an*******@dis cussions.micros oft.com> wrote in message >news:14******* *************** ******@phx.gbl. .. >> It still doesn't work. Here is exactly what I have now: >> >> <script language="javas cript"> >> var sessionServer = "<%=jsTestServe r%>"; >> alert(sessionSe rver); >> >> function CreateSessionFl ag() >> { >> alert("hello"); >> } >> >> function DeleteSessionFl ag() >> { >> alert("bye"); >> } >> </script> >> </head> >> <body MS_POSITIONING= "GridLayout " >> onLoad="CreateS essionFlag();"> >> >> In the C# code behind: >> public class WebForm1 : System.Web.UI.P age >> { >> public string jsTestServer >> = "\\\\ze483z\\Te stSession\\"; >> >> private void Page_Load(objec t sender, System.EventArg s >> e) >> { // Put user code to initialize the page here } >> >> It's a very simple test program. After I changed to "<% >> =jsTestServer%> ", it generates some jscript error - >> object expected on the "onload" line. If I used the old >> way var sessionServer = "<%#jsTestServe r%>"; it
pops up >> an alert with empty message. >> >> >> >-----Original Message----- >> ><%# is the DataBinding syntax. You need to make
sure >> you call DataBind() on >> >your page (in the server code. You can also use <% >> =someVariable%> , which >> >will print the value out when it runs. The
DataBind way >> is a little more >> >elegant, I feel. >> > >> >-mike >> >MVP >> > >> >"Jade" <an*******@disc ussions.microso ft.com> wrote
in >> message >> >news:12******* *************** ******@phx.gbl. .. >> >> I saw some web page saying I could do it this
way in >> >> javascript: >> >> var iNumber = <%#publicvarnam e [or] publicpropertyn ame >> %> >> >> >> >> but it doesn't seem to work. I have this piece
of code >> >> here in javascript: >> >> <script language="javas cript"> >> >> var sessionServer = "<%#jsTestServe r%>"; >> >> alert(sessionSe rver); >> >> </script> >> >> >> >> and the variable is defined in the C# code
behind: >> >> public string jsTestServer >> >> = "\\\\TestServer \\TestSession\\ "; >> >> >> >> when I run it, alert has no message in it. >> > >> > >> >. >> > > > >. >
.
The runtime error is from JScript most likely.
var sessionServer = "\\ze483z\TestS ession\"; is not a valid string literal.
-mike
MVP
"Jade" <an*******@disc ussions.microso ft.com> wrote in message
news:03******** *************** *****@phx.gbl.. . I'm sorry, Mike. I still don't know where to put "this.DataBind( );" I put it in private void Page_Load(objec t sender, System.EventArg s e) { this.DataBind() ; }
and I still have the runtime error.
-----Original Message----- It did interpreted correctly in HTML: var sessionServer = "\\ze483z\TestS ession\";
Right, and that's not valid for JScript, thus the runtime error. where/how should I use "this.DataBind( );" exactly in Onload???
this.DataBind( ); // That's it
That binds all the <%# markers.
-mike MVP
>-----Original Message----- >Check out HTML output. If you have \\ characters, they will get interpreted >by C#. Try with your variable as "Hello, JScript!" :). > >Using the <%# syntax, did you do a this.DataBind() ; call in your OnLoad or >somewhere? > >-mike >MVP > ><an*******@dis cussions.micros oft.com> wrote in message >news:14******* *************** ******@phx.gbl. .. >> It still doesn't work. Here is exactly what I have now: >> >> <script language="javas cript"> >> var sessionServer = "<%=jsTestServe r%>"; >> alert(sessionSe rver); >> >> function CreateSessionFl ag() >> { >> alert("hello"); >> } >> >> function DeleteSessionFl ag() >> { >> alert("bye"); >> } >> </script> >> </head> >> <body MS_POSITIONING= "GridLayout " >> onLoad="CreateS essionFlag();"> >> >> In the C# code behind: >> public class WebForm1 : System.Web.UI.P age >> { >> public string jsTestServer >> = "\\\\ze483z\\Te stSession\\"; >> >> private void Page_Load(objec t sender, System.EventArg s >> e) >> { // Put user code to initialize the page here } >> >> It's a very simple test program. After I changed to "<% >> =jsTestServer%> ", it generates some jscript error - >> object expected on the "onload" line. If I used the old >> way var sessionServer = "<%#jsTestServe r%>"; it pops up >> an alert with empty message. >> >> >> >-----Original Message----- >> ><%# is the DataBinding syntax. You need to make sure >> you call DataBind() on >> >your page (in the server code. You can also use <% >> =someVariable%> , which >> >will print the value out when it runs. The DataBind way >> is a little more >> >elegant, I feel. >> > >> >-mike >> >MVP >> > >> >"Jade" <an*******@disc ussions.microso ft.com> wrote in >> message >> >news:12******* *************** ******@phx.gbl. .. >> >> I saw some web page saying I could do it this way in >> >> javascript: >> >> var iNumber = <%#publicvarnam e [or] publicpropertyn ame >> %> >> >> >> >> but it doesn't seem to work. I have this piece of code >> >> here in javascript: >> >> <script language="javas cript"> >> >> var sessionServer = "<%#jsTestServe r%>"; >> >> alert(sessionSe rver); >> >> </script> >> >> >> >> and the variable is defined in the C# code behind: >> >> public string jsTestServer >> >> = "\\\\TestServer \\TestSession\\ "; >> >> >> >> when I run it, alert has no message in it. >> > >> > >> >. >> > > > >. >
.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sue |
last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided
to improve character checking on my project. In my project I only had
to do very basic validation. Therefore, I only had one function to
verify the name fields, age, email and gender.
My question is: if I create a function for each field like the code
below, what would be the best way to organize the functions and call
them? Would I need one main function and place...
|
by: cheezebeetle |
last post by:
ok, so I am having problems passing in an ASPX function into the Javascript in the codebehind page. I am simply using a confirm call which when they press "OK" they call this ASPX function, when they press "Cancel" they call another ASPX function.
My code now is:
System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=""JavaScript"">" & vbCrLf)
System.Web.HttpContext.Current.Response.Write("if (confirm('Are you sure you want to...
|
by: Jade |
last post by:
I saw some web page saying I could do it this way in
javascript:
var iNumber = <%#publicvarname publicpropertyname %>
but it doesn't seem to work. I have this piece of code
here in javascript:
<script language="javascript">
var sessionServer = "<%#jsTestServer%>";
alert(sessionServer);
</script>
|
by: abcd |
last post by:
I am novice asp.net programmer.
I have xyz.js file which has resuable functions. I have asp.net form
abcd.aspx and the code behind file abcd.aspx.cs, I want to put a 'Help'
button when clicked it will open a window and open the required file for
me.
I am have issues
1.I tried calling my xyz.js function i.e. ShowHelp in the call like in my
|
by: KaNos |
last post by:
Hi,
"robot script pages" are html+javascript pages, can be played in aspx
player. So in this tech, robot call aspx player's function (an interface is
sheared) and wait a result synchronously with a javascript method. I try it
with GetCallbackEventReference but this tech works async. Could I use a
javascript function with a sync call ?
Thaks for responses,
| |
by: hibaru |
last post by:
Hi
Is it possible to call a javascript function from a treeview controls
OnSelectedNodeChanged event? Something similar to a OnClientClick event
for buttons? I cant seem to find anyway to do this, any help
appreciated
Thanks
|
by: verci |
last post by:
Hi guys,
I'm running asp.net 2.0.
Does anyone know how to fire or call a javascript function from inside my
(VB.aspx) code without assigning it to a control attribute?
thank you
|
by: moni |
last post by:
Hi..
I am trying to use javascript for google maps display.
If I call the javascript function from my aspx file I use:
<input type="text" id="addresstext" value="Huntington Avenue,
Boston, MA" name="yourName" style="width: 287px" />
|
by: supin |
last post by:
hi,
i work in asp.net2.0/c#.not much expert in javascript.i have a variable declared in the c# code behind page.assume the variable contains some value.
i have a javascript function in the <script> </script> area of the html source view of the corresponding aspx(asp.net)page.
my requirement is how do i access the variable which i mentioned above in the c# code behind page?i need to use the variable in the javascript function.
...
|
by: Ty |
last post by:
Hello all,
I am creating a web site with Visual Stuido 2008. I am trying to use
a java script file to create a busybox for login from this page
http://blogs.crsw.com/mark/articles/642.aspx.
I am using a master page senerio.
The erro I'm getting is
'busyBox' is not a member of 'ASP.login2_aspx'
|
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,...
| |
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |