473,480 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Variable from code behind into ASP page.

Isn't there a way to get your variable to display in a page with something
like this <% MyVar %>

That just isn't working for me. What am I missing?

Thanks!

--
Only the Best Freeware at http://www.vbmark.com
Jul 1 '07 #1
9 1400
On Jul 1, 7:37 am, vbMark <n...@email.comwrote:
Isn't there a way to get your variable to display in a page with something
like this <% MyVar %>

That just isn't working for me. What am I missing?

Thanks!

--
Only the Best Freeware athttp://www.vbmark.com
HI...

<%# MyVar %>
this. is databinding ...
but for this you got to call page.databind()

Thanks
Masudur
www.kaz.com.bd
http://munnacs.110mb.com

Jul 1 '07 #2
<% MyVar %only evaluates MyVar and doesn't return anything.

<%= MyVar %returns MyVar value.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"vbMark" <no@email.comwrote in message
news:Xn********************@199.45.49.11...
Isn't there a way to get your variable to display in a page with something
like this <% MyVar %>

That just isn't working for me. What am I missing?

Thanks!

--
Only the Best Freeware at http://www.vbmark.com

Jul 1 '07 #3
"vbMark" <no@email.comwrote in message
news:Xn********************@199.45.49.11...
Isn't there a way to get your variable to display in a page with something
like this <% MyVar %>

That just isn't working for me. What am I missing?
<% = MyVar %>

The equals sign is shorthand for Response.Write
--
http://www.markrae.net

Jul 1 '07 #4
Also I think the variable need to be marked as internal or protected to be
able to be accesed from the aspx source

HTH

Siva

"Mark Rae" wrote:
"vbMark" <no@email.comwrote in message
news:Xn********************@199.45.49.11...
Isn't there a way to get your variable to display in a page with something
like this <% MyVar %>

That just isn't working for me. What am I missing?

<% = MyVar %>

The equals sign is shorthand for Response.Write
--
http://www.markrae.net

Jul 1 '07 #5
"Sivakumar G" <Si********@discussions.microsoft.comwrote in message
news:C4**********************************@microsof t.com...
Also I think the variable need to be marked as internal or protected to be
able to be accesed from the aspx source
protected or public - internal won't be visible...
--
http://www.markrae.net

Jul 1 '07 #6
Hi Mark,

As other members have mentioned, for ASP.NET, the classic ASP like inline
express such as <%= variable or function %still work, you can use it to
display value in aspx template based on some page's member variable(or
helper function) in codebehind. Also, you need to make sure that the
variable or function is non-private (protected or public ) so that they can
be referenced in aspx template.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 2 '07 #7
Mark,

Internal works for me as protected/public. FYI I tested using ASP .net 2.0.
Here the point is that what Steven suggested. A non private variable will do
the job.

cheers

Siva

"Mark Rae" wrote:
"Sivakumar G" <Si********@discussions.microsoft.comwrote in message
news:C4**********************************@microsof t.com...
Also I think the variable need to be marked as internal or protected to be
able to be accesed from the aspx source

protected or public - internal won't be visible...
--
http://www.markrae.net

Jul 2 '07 #8
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:Y2**************@TK2MSFTNGHUB02.phx.gbl...
As other members have mentioned, for ASP.NET, the classic ASP like inline
express such as <%= variable or function %still work, you can use it to
display value in aspx template based on some page's member variable(or
helper function) in codebehind. Also, you need to make sure that the
variable or function is non-private (protected or public ) so that they
can
be referenced in aspx template.
Er, yes I know, as per my earlier post (the one you appear to be replying
to)...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 2 '07 #9
Thanks for your reply Mark,

Oh, I originally reply to the OP "vbMark", just haven't noticed that there
are more than one Mark here :-). Sure, appreciate your informative input
here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 2 '07 #10

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

Similar topics

2
6150
by: lsf_80 | last post by:
I am using ASP.net and C# as code behind. I wrote one function in the "page load" (code behind) and how can i call back the variable in the aspx page? Thank you. if i put response.write,...
1
1944
by: Andrew Pasetti | last post by:
I'm having trouble binding/displaying a class variable to the display aspx page. Perhaps someone can suggest what I am doing wrong. ################################### Within the .aspx page I...
4
3493
by: Bob T | last post by:
Hi All, I am trying to pass a variable from my VB asp.net script (from for example Sub Page_Load in mypage.aspx.vb) to my Client side script. I have found and looked at a very good example...
3
807
by: Wayne Wengert | last post by:
I have an application where a session variable is set in an ASPX page, The process calls an ASP page and when in that page the session variable appears to be null. How can I pass a session variable...
3
2526
by: Ryan Taylor | last post by:
Hi. I need to be able to access a public code behind variable within my ASPX page. The reason is that I have a user control "Header" which defines a table layout, and is included in all my...
12
2910
by: Phil Certain | last post by:
Hi, I'm trying to do something very simple...or at least it should be. I have created a host page (gen.aspx) and a very simple user control (us.ascx). The corresponding code-behind files are...
5
3509
by: Paul | last post by:
Just wondering if someone could provide an example of passing a variable from the code behind to javascript in vb. I want to have one control have focus with the page loading with one condition...
3
3921
by: Pierre | last post by:
Hello, In an aspx page (mypage.aspx) from a web projet, I would like to get the value of a variable of the projet that is declared as public in a module. The variable can be called from...
4
2644
by: simon | last post by:
hello. relatively new to vb.net, i'm using VS 2003 and .net 2.0 i have a web app that i'm i have a user control that displays a simple 1 row table as the header of the page. the user control...
1
9873
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...
0
7044
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
6908
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
7045
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,...
1
6741
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...
0
6944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5341
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,...
0
4483
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
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...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.