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

Codebehind -> Src?

Hi,

im just the beginner and im using c#-codebehind in my
asp.net-application....
What should i do to make my application work "without" code-behind (without
dll.-s in bin-folder)?

I was googling something about Src instead of Codebehind (in @page
directive) but i dont know where to start...

Please help,

thanks in advance,

Krunom.
Nov 19 '05 #1
11 1461
Hi,

You need to write all the code that you might write in the code behind file,
directly to the HTML code area.
something similar to java scripts that you write on the page.

regds,

"Krunom Ancini" wrote:
Hi,

im just the beginner and im using c#-codebehind in my
asp.net-application....
What should i do to make my application work "without" code-behind (without
dll.-s in bin-folder)?

I was googling something about Src instead of Codebehind (in @page
directive) but i dont know where to start...

Please help,

thanks in advance,

Krunom.

Nov 19 '05 #2
Hi,

You need to write all the code that you might write in the code behind file,
directly to the HTML code area.
something similar to java scripts that you write on the page.

regds,

"Krunom Ancini" wrote:
Hi,

im just the beginner and im using c#-codebehind in my
asp.net-application....
What should i do to make my application work "without" code-behind (without
dll.-s in bin-folder)?

I was googling something about Src instead of Codebehind (in @page
directive) but i dont know where to start...

Please help,

thanks in advance,

Krunom.

Nov 19 '05 #3
Put this at the top of the ASPX file:
<%@ Page language="C#" src="YourCodebehind.aspx.cs" AutoEventWireup="false"
Inherits="YourNamespace.YourCodebehind" %>

Write the codebehind class as normally.

Server code may also be embedded directly at the top of the ASPX page,
although i would not recommend it.
<script language="C#" runat="server">
// Code
</script>

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Krunom Ancini" <kr****@hotmail.com> wrote in message
news:38*************@individual.net...
Hi,

im just the beginner and im using c#-codebehind in my
asp.net-application....
What should i do to make my application work "without" code-behind
(without dll.-s in bin-folder)?

I was googling something about Src instead of Codebehind (in @page
directive) but i dont know where to start...

Please help,

thanks in advance,

Krunom.

Nov 19 '05 #4
Put this at the top of the ASPX file:
<%@ Page language="C#" src="YourCodebehind.aspx.cs" AutoEventWireup="false"
Inherits="YourNamespace.YourCodebehind" %>

Write the codebehind class as normally.

Server code may also be embedded directly at the top of the ASPX page,
although i would not recommend it.
<script language="C#" runat="server">
// Code
</script>

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Krunom Ancini" <kr****@hotmail.com> wrote in message
news:38*************@individual.net...
Hi,

im just the beginner and im using c#-codebehind in my
asp.net-application....
What should i do to make my application work "without" code-behind
(without dll.-s in bin-folder)?

I was googling something about Src instead of Codebehind (in @page
directive) but i dont know where to start...

Please help,

thanks in advance,

Krunom.

Nov 19 '05 #5
Krunom,

As a beginner you should follow normal ways. If you wish, you can place all
the code inside .aspx file, although it will certainly delay your promoting
from the "beginner grade". But what in the world do you have against dlls in
bin folder?

Eliyahu

"Krunom Ancini" <kr****@hotmail.com> wrote in message
news:38*************@individual.net...
Hi,

im just the beginner and im using c#-codebehind in my
asp.net-application....
What should i do to make my application work "without" code-behind (without dll.-s in bin-folder)?

I was googling something about Src instead of Codebehind (in @page
directive) but i dont know where to start...

Please help,

thanks in advance,

Krunom.

Nov 19 '05 #6
Krunom,

As a beginner you should follow normal ways. If you wish, you can place all
the code inside .aspx file, although it will certainly delay your promoting
from the "beginner grade". But what in the world do you have against dlls in
bin folder?

Eliyahu

"Krunom Ancini" <kr****@hotmail.com> wrote in message
news:38*************@individual.net...
Hi,

im just the beginner and im using c#-codebehind in my
asp.net-application....
What should i do to make my application work "without" code-behind (without dll.-s in bin-folder)?

I was googling something about Src instead of Codebehind (in @page
directive) but i dont know where to start...

Please help,

thanks in advance,

Krunom.

Nov 19 '05 #7
What you need to ask yourself is What is your development envorinment? If
its VS then leverage the tool. The Codebehind attribute is specific to VS
only. ASP.NET ignores this at runtime. You can use the src attribute; but
then you are telling VS that you dont want to have your pages pre-compiled.

If its Visual Notepad, then the SRC attribute might be a little better.
Your pages are not going to be pre-compiled, so you might as well let the
..net framework compile it at runtime.
"Krunom Ancini" <kr****@hotmail.com> wrote in message
news:38*************@individual.net...
Hi,

im just the beginner and im using c#-codebehind in my
asp.net-application....
What should i do to make my application work "without" code-behind
(without dll.-s in bin-folder)?

I was googling something about Src instead of Codebehind (in @page
directive) but i dont know where to start...

Please help,

thanks in advance,

Krunom.

Nov 19 '05 #8

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uP**************@TK2MSFTNGP10.phx.gbl...
But what in the world do you have against dlls in
bin folder?


I have nothing, but my web-host does :(

Do you know any free asp.net web-host with codebehind-support? :)
Nov 19 '05 #9

"Tampa.NET Koder" <an*******@microsoft.com> wrote in message
news:eF**************@TK2MSFTNGP15.phx.gbl...
What you need to ask yourself is What is your development envorinment?
It's VS!
You can use the src attribute
in @page directive instead of "Codebehind" i should only write "src" and
thats it? so simple?
then you are telling VS that you dont want to have your pages
pre-compiled.


And what is the bad thing about it? speed? data-amount?
Nov 19 '05 #10

"Dennis Myrén" <de****@oslokb.no> wrote in message
news:OJ*************@tk2msftngp13.phx.gbl...
Put this at the top of the ASPX file:
<%@ Page language="C#" src="YourCodebehind.aspx.cs"
AutoEventWireup="false" Inherits="YourNamespace.YourCodebehind" %>

Write the codebehind class as normally.


Sounds simple :)
and i tried it and it didnt work but ill keep trying :)

Thanks...
Nov 19 '05 #11
You do not have to have a CodeBehind, but the page will have to follow
certain rules. You can wire events either programatically or declaratively.

EXAMPLE 1: Programatic
-----------------------------
<%@ Page language="c#" AutoEventWireup="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>UglyPage</title>
<script language="C#" runat="server">
// Page Load
private void Page_Load(object sender, System.EventArgs e)
{
}

override protected void OnInit(EventArgs e)
{
//Need an init to start the page
InitializeComponent();
base.OnInit(e);
}

private void InitializeComponent()
{
this.btnFill.Click += new System.EventHandler(this.btnFill_Click);
this.Load += new System.EventHandler(this.Page_Load);

}

private void btnFill_Click(object sender, System.EventArgs e)
{
txtFill.Text = btnFill.Text;
}
</script>

</HEAD>
<body>

<form id="Form1" method="post" runat="server">

<h1>This is an ugly page</h1>
<P><asp:Button id=btnFill runat="server" Text="Click me to fill text
box"></asp:Button><asp:TextBox id=txtFill runat="server"></asp:TextBox></P>

</form>

</body>
</HTML>

EXAMPLE 2: Declarative
----------------------------
<%@ Page language="c#" AutoEventWireup="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>UglyPage</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">

<script language="C#" runat="server">
private void btnFill_Click(object sender, System.EventArgs e)
{
txtFill.Text = btnFill.Text;
}
</script>

</HEAD>
<body>

<form id="Form1" method="post" runat="server">

<h1>This is an ugly page</h1>
<P><asp:Button id=btnFill runat="server" Text="Click me to fill text box"
OnClick="btnFill_Click"></asp:Button><asp:TextBox id=txtFill
runat="server"></asp:TextBox></P>

</form>

</body>
</HTML>

Wiring
OnClick="btnFill_Click" = declarative
this.btnFill.Click += new System.EventHandler(this.btnFill_Click); =
programatic

The src="" still uses a "CodeBehind" file, but it is dynamically compiled
when the page is hit rather than precompiled to IL when you deploy. Src=""
does not work in Visual Studio .NET, so do not use it if you are heading that
route.
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

"Krunom Ancini" wrote:
Hi,

im just the beginner and im using c#-codebehind in my
asp.net-application....
What should i do to make my application work "without" code-behind (without
dll.-s in bin-folder)?

I was googling something about Src instead of Codebehind (in @page
directive) but i dont know where to start...

Please help,

thanks in advance,

Krunom.

Nov 19 '05 #12

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

Similar topics

2
by: Graham Allwood | last post by:
I'm reading the Essential ASP.NET book by Fritz onion and he says that when VS.NET creates a new .aspx page for you is uses the codebehind attribute on the Page directive rather than the src...
4
by: Boban Dragojlovic | last post by:
I create a new webform (I always use codebehind), and I insert some server-side controls into the form (the ASPX) Later, I switch to codeview, and I notice that some (sometimes all) of the...
6
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked...
12
by: A.M | last post by:
Hi, Using VS.NET 2003, If i use SRC page attribute instead of CodeBehind, do i still have intelisence and generally IDE support for that? Thanks, Ali
3
by: nevets2001uk | last post by:
Hi. I've just started my second ASP.NET (VB) app and I'm using codebehind this time. I'm not using visual studio but am instead coding it all in notepad (HTML, ASP.NET and CSS) I'm trying to...
12
by: Karl Hungus | last post by:
If I use a code behind class for an aspx page, what is the best way to get data from the codebehind class into my aspx page? I know about databinding, but is there a more basic way of just...
3
by: jm | last post by:
I have a question about codebehind. I have an upload namespace, class and all in a codebehind. I currently have it so it works with one of my .aspx pages. I want to use it for another .aspx...
4
by: Mat | last post by:
Hi, I am having a bit of a problem trying to access / set properties of a usercontrol from the parent codebehind. This is what I have so far.. simple.aspx <%@ Page...
6
by: antonyliu2002 | last post by:
Right now I put my VB code in the aspx pages. I would prefer to use codebehind, especially many of my VB functions may be shared across multiple aspx pages. I've tried a few pages with...
6
by: WT | last post by:
Hello, I am searching for a way to generate automatically from codebehind the <!Doctype....for asp.net pages using .net 3.5 c# and vs2008. Subidiary question: if I do a server transfert in my...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
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...
0
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
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
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
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...

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.