473,386 Members | 1,819 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,386 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 1460
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
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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,...

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.