473,508 Members | 2,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<% %> tag to get value

Hello!

I am trying to write a simple aspx page with You are logged on as <% getuser(); %> in the body text.
In my code-behind I write (for test:
public String getuser()
{
String s = Environment.UserDomainName + "\\" + Environment.UserName;
return "testing"; // s;
}

Nothing is returned. Why?!?! What should I do instead?
Regards Magnus
Nov 19 '05 #1
2 1352
What are you doing the the resultant string? ASP.Net is evaluating it properly, but you don't tell it what to do with it. Try instead <% Response.Write(getuser()); %>

You might have better luck though avoiding this older ASP approach. Instead, add an asp.net label control there. Then, in your code behind you can simply set the label's text attribute to the getuser() function and not have any of the issues with trying to have inline calls to code-behind.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Magnus Blomberg" <ma*************@skanska.se> wrote in message news:eI**************@TK2MSFTNGP09.phx.gbl...
Hello!

I am trying to write a simple aspx page with You are logged on as <% getuser(); %> in the body text.
In my code-behind I write (for test:
public String getuser()
{
String s = Environment.UserDomainName + "\\" + Environment.UserName;
return "testing"; // s;
}

Nothing is returned. Why?!?! What should I do instead?
Regards Magnus
Nov 19 '05 #2
Thanks, works just fine by using reponse.write.

I have used .net components for a while but I always have to go via the
page_load event and call a procedure or set the value there.
Do I miss something or is that the recommended way?

Regards Magnus

"Mark Fitzpatrick" <ma******@fitzme.com> wrote in message
news:O3**************@tk2msftngp13.phx.gbl...
What are you doing the the resultant string? ASP.Net is evaluating it
properly, but you don't tell it what to do with it. Try instead <%
Response.Write(getuser()); %>

You might have better luck though avoiding this older ASP approach. Instead,
add an asp.net label control there. Then, in your code behind you can simply
set the label's text attribute to the getuser() function and not have any of
the issues with trying to have inline calls to code-behind.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Magnus Blomberg" <ma*************@skanska.se> wrote in message
news:eI**************@TK2MSFTNGP09.phx.gbl...
Hello!

I am trying to write a simple aspx page with You are logged on as <%
getuser(); %> in the body text.
In my code-behind I write (for test:
public String getuser()
{
String s = Environment.UserDomainName + "\\" + Environment.UserName;
return "testing"; // s;
}

Nothing is returned. Why?!?! What should I do instead?
Regards Magnus

Nov 19 '05 #3

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

Similar topics

9
2944
by: Francesco Moi | last post by:
Hello. I'm trying to build a RSS feed for my website. It starts: ----------------//--------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE rss PUBLIC "-//Netscape...
1
6794
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
2
3185
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
2
10537
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
129
64455
by: Torbjørn Pettersen | last post by:
I've started cleaning up my HTML and implementing CSS. So far I've used FrontPage, but am switching over to DreamWeaver. Reading a bit on W3Schools.com and W3.org I see there are a lot of HTML...
34
10972
by: Mark Moore | last post by:
It looks like there's a pretty serious CSS bug in IE6 (v6.0.2800.1106). The HTML below is validated STRICT HTML 4.01 and renders as I would expect in Opera, FrontPage, and Netscape. For some...
11
13657
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
2
6824
by: andrew007 | last post by:
I do xml / xslt transformation using asp.net but I found any value (w/xml format) in xml node html-encoded to &lt and &gt format if it's > or < tag. Since I have sub xml data in a parent xml node...
4
3012
by: David Lozzi | last post by:
Howdy, I'm using a WYSIWYG editor called TinyMCE. When I edit some text and then save it back to my SQL server using a SQLCommand, all HTML characters are changed to HTML code, i.e. &gt;strong&lt;...
6
24226
by: tentstitcher | last post by:
Hi all: I have a source xml document with an element of type string. This element contains something like the following: <stringData> &lt;Header&gt; &lt;Body&gt; </stringData> I would like to apply an...
0
7231
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
7336
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,...
0
7401
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...
1
7063
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
5640
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,...
1
5059
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...
0
4720
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
1568
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 ...
0
432
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...

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.