PC Review


Reply
Thread Tools Rate Thread

Codebehind -> Src?

 
 
Krunom Ancini
Guest
Posts: n/a
 
      1st Mar 2005
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.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2FubmFuLlYgW01DU0QubmV0XQ==?=
Guest
Posts: n/a
 
      1st Mar 2005
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.
>
>
>

 
Reply With Quote
 
Dennis Myrén
Guest
Posts: n/a
 
      1st Mar 2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      1st Mar 2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
Tampa.NET Koder
Guest
Posts: n/a
 
      1st Mar 2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
Krunom Ancini
Guest
Posts: n/a
 
      1st Mar 2005

"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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?


 
Reply With Quote
 
Krunom Ancini
Guest
Posts: n/a
 
      1st Mar 2005

"Tampa.NET Koder" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?


 
Reply With Quote
 
Krunom Ancini
Guest
Posts: n/a
 
      1st Mar 2005

"Dennis Myrén" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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...


 
Reply With Quote
 
=?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
Guest
Posts: n/a
 
      1st Mar 2005
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.
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Codebehind And SRC BJ-Mac Donel Microsoft ASP .NET 1 25th May 2005 01:58 PM
codebehind =?Utf-8?B?TWFydGlu?= Microsoft ASP .NET 0 23rd Mar 2004 03:51 PM
Using Codebehind nevets2001uk Microsoft ASP .NET 3 21st Jan 2004 01:43 PM
Don't want to use codebehind... M Microsoft ASP .NET 2 7th Oct 2003 02:16 PM
Why does VS.NET use codebehind? Graham Allwood Microsoft ASP .NET 2 18th Jul 2003 01:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:30 AM.