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

code behind again

wei
thank Carl. do you mean there is no good way to reach the same goal as the
Response.Write does in code behind except adding a label on it?

Nov 18 '05 #1
2 876
wei wrote:
thank Carl. do you mean there is no good way to reach the same goal
as the Response.Write does in code behind except adding a label on it?


Wei,
Response.Write was the method used in classic ASP.

With ASP.NET, you now read and write to either HTML controls or
Web control's properties. By default, Web controls will already run
server-side. For HTML controls, you can get them to run server-side
by right clicking on the HTML control (in Designer view) and select
"Run As Server Control".
e.g.
In ASPX file
<ASP:LABEL id="Label1" runat="server" />

Then in the code behind file:
protected System.Web.UI.WebControls.Label Label1;
...
Label1.Text = "Hello ASP.NET World";

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Nov 18 '05 #2
wei
thank you for help!

"Carl Prothman [MVP]" <ca****@spamcop.net> wrote in message
news:Ou**************@TK2MSFTNGP10.phx.gbl...
wei wrote:
thank Carl. do you mean there is no good way to reach the same goal
as the Response.Write does in code behind except adding a label on it?


Wei,
Response.Write was the method used in classic ASP.

With ASP.NET, you now read and write to either HTML controls or
Web control's properties. By default, Web controls will already run
server-side. For HTML controls, you can get them to run server-side
by right clicking on the HTML control (in Designer view) and select
"Run As Server Control".
e.g.
In ASPX file
<ASP:LABEL id="Label1" runat="server" />

Then in the code behind file:
protected System.Web.UI.WebControls.Label Label1;
...
Label1.Text = "Hello ASP.NET World";

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Nov 18 '05 #3

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

Similar topics

242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
17
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but...
21
by: Sandy | last post by:
Hello - I am using Visual Studio .Net. I need an example of how to construct a class that can be used throughout a project where I can include its subs and functions in various pages in the...
3
by: Iluvatar | last post by:
Hi, last week our project upgraded from vs.net 2005 to vs.net 2008. Our project still uses framework 2.0, because the deployment servers are not 3.x ready yet. Everything so far while migrating...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.