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

how to use a variable defined in aspx.cs in an aspx file

19
Hello,

I have a variable in a ".cs.aspx" file and I want to use it in the same page's ".aspx" file, I tried using Reponse.Write with the help of the syntax:

Expand|Select|Wrap|Line Numbers
  1. <%Response.Write(var)%>
But it isn't working, it shows var as unknown. Could anyone please help?
Apr 27 '11 #1

✓ answered by NitinSawant

did u try making the variable public in the code behind file

Expand|Select|Wrap|Line Numbers
  1. public string TestVariable="Test";
  2.  
Expand|Select|Wrap|Line Numbers
  1. <%Response.Write(TestVariable)%>
  2.  

3 4302
NitinSawant
270 100+
did u try making the variable public in the code behind file

Expand|Select|Wrap|Line Numbers
  1. public string TestVariable="Test";
  2.  
Expand|Select|Wrap|Line Numbers
  1. <%Response.Write(TestVariable)%>
  2.  
May 9 '11 #2
kino
19
No, but I used it as a protected string variable and it worked, will this work too?

Anyway, thanks for the reply!
May 9 '11 #3
NitinSawant
270 100+
yes this will work,

protected also works
May 9 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: MC | last post by:
HI to all, First excuse me but i'm xsl beginner. I'm using XSL to transform an xml file into another. I'm using a Java program for the transformation (TraX API). I would like to recover in...
4
by: Dan Elliott | last post by:
Hello, Converting from a working C program to C++, I run into the following error: I have a header: (header.h) namespace shared{ ... struct X{ ...
2
by: Shapper | last post by:
Hello, I have an aspx page which in its script has: Sub Page_Load(...) ... End Sub And 2 functions:
3
by: Steve Jacobs | last post by:
Hi, I need to run a vb.net or aspx.net file every 10 seconds. The Task Scheduler in Windows 2003 Server can only do it every 1 minute at the minimum, but I need it every 10 seconds. Is it...
5
by: jeet_sen | last post by:
Hi, My external javascript test.js contains a variable definition var a = "Hello,world!!"; I dynamically loaded the script test.js using the following fucntion: function loadScript(url) { var...
1
by: Chris | last post by:
Hi, I use code-behind, but how can i pass a variable from test.aspx.vb to test.aspx? Test.aspx.vb contains this: Partial Class test Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal...
5
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,...
0
by: Nitinkcv | last post by:
Hi, Im currently using .NET 1.1 in Visual studio .net 2003. The thing is on opening the .csproj the aspx.cs files are not showing up. usually there a '+' sign near the aspx file and on clicking...
4
by: CES | last post by:
All, How do you write out a variable in a ASPX .inc?? I've used the following in my code and it worked until I changed the date & MyWebSite, to a server side write... is there any way of getting...
1
by: arsha123 | last post by:
How can I change the value of empty session variable with another variable value defined in form. I get value of session value of id from a logon form , that is "". I have defined a variable in form...
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:
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.