By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,925 Members | 1,824 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,925 IT Pros & Developers. It's quick & easy.

Using inline-code with code behind.

P: n/a
I'm trying to use Inline-code to call Page_load, Page_Init or Page_PreRender
methods.

I've also got a code behind c#-file.

I can define inline methods for buttons and so on...that works fine. But
when I try to call Page_load, Page_Init or Page_PreRender methods it doesn't
work.

Non of the methods get's triggered !?

How can I solve this problem with combining code behind and inline-code?
I just need an action to call my own defined dll-call, it must be done in
inlin -code!

Regards
/Anders



Nov 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Anders:
I can't see why you HAVE to use both..that doesn't really make sense to me.
Why not just create a function called "Initialize()" in codebehind which you
can call in the inline page_load event?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Anders M" <it*****@du.se> wrote in message
news:eO**************@tk2msftngp13.phx.gbl...
I'm trying to use Inline-code to call Page_load, Page_Init or
Page_PreRender
methods.

I've also got a code behind c#-file.

I can define inline methods for buttons and so on...that works fine. But
when I try to call Page_load, Page_Init or Page_PreRender methods it
doesn't
work.

Non of the methods get's triggered !?

How can I solve this problem with combining code behind and inline-code?
I just need an action to call my own defined dll-call, it must be done in
inlin -code!

Regards
/Anders


Nov 19 '05 #2

P: n/a
Because I don't have access to the code behind file! I'm modifying an
..ascx-file that's using several dll's made third part developers.

Maybe I can make a dll and override Page_Load event?
/Anders

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
skrev i meddelandet news:uz******************@TK2MSFTNGP12.phx.gbl...
Anders:
I can't see why you HAVE to use both..that doesn't really make sense to me. Why not just create a function called "Initialize()" in codebehind which you can call in the inline page_load event?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Anders M" <it*****@du.se> wrote in message
news:eO**************@tk2msftngp13.phx.gbl...
I'm trying to use Inline-code to call Page_load, Page_Init or
Page_PreRender
methods.

I've also got a code behind c#-file.

I can define inline methods for buttons and so on...that works fine. But
when I try to call Page_load, Page_Init or Page_PreRender methods it
doesn't
work.

Non of the methods get's triggered !?

How can I solve this problem with combining code behind and inline-code?
I just need an action to call my own defined dll-call, it must be done in inlin -code!

Regards
/Anders



Nov 19 '05 #3

P: n/a
I guess I still don't understand..

Given the following inline:

<script language="C#" runat="server">
void Page_Load(object sender, EventArgs e){
Response.Write("1");
}
</script>

and the following codebehind:

private void Page_Load(object sender, EventArgs e)
{
Response.Write("2");
}

both events will fire....

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Anders M" <it*****@du.se> wrote in message
news:Oc***************@TK2MSFTNGP10.phx.gbl...
Because I don't have access to the code behind file! I'm modifying an
.ascx-file that's using several dll's made third part developers.

Maybe I can make a dll and override Page_Load event?
/Anders

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
skrev i meddelandet news:uz******************@TK2MSFTNGP12.phx.gbl...
Anders:
I can't see why you HAVE to use both..that doesn't really make sense to

me.
Why not just create a function called "Initialize()" in codebehind which

you
can call in the inline page_load event?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Anders M" <it*****@du.se> wrote in message
news:eO**************@tk2msftngp13.phx.gbl...
> I'm trying to use Inline-code to call Page_load, Page_Init or
> Page_PreRender
> methods.
>
> I've also got a code behind c#-file.
>
> I can define inline methods for buttons and so on...that works fine.
> But
> when I try to call Page_load, Page_Init or Page_PreRender methods it
> doesn't
> work.
>
> Non of the methods get's triggered !?
>
> How can I solve this problem with combining code behind and
> inline-code?
> I just need an action to call my own defined dll-call, it must be done in > inlin -code!
>
> Regards
> /Anders
>
>
>
>
>
>
>



Nov 19 '05 #4

P: n/a


For me the inline Page_Load don't fire!
If I remove <@Page Language="c#" codebehind="WebForm1.aspx.cs".......> The
Inline code fires!

Else only the codebehind code.

/Anders


"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
skrev i meddelandet news:uy**************@TK2MSFTNGP10.phx.gbl...
I guess I still don't understand..

Given the following inline:

<script language="C#" runat="server">
void Page_Load(object sender, EventArgs e){
Response.Write("1");
}
</script>

and the following codebehind:

private void Page_Load(object sender, EventArgs e)
{
Response.Write("2");
}

both events will fire....

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Anders M" <it*****@du.se> wrote in message
news:Oc***************@TK2MSFTNGP10.phx.gbl...
Because I don't have access to the code behind file! I'm modifying an
.ascx-file that's using several dll's made third part developers.

Maybe I can make a dll and override Page_Load event?
/Anders

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
skrev i meddelandet news:uz******************@TK2MSFTNGP12.phx.gbl...
Anders:
I can't see why you HAVE to use both..that doesn't really make sense to

me.
Why not just create a function called "Initialize()" in codebehind
which you
can call in the inline page_load event?

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Anders M" <it*****@du.se> wrote in message
news:eO**************@tk2msftngp13.phx.gbl...
> I'm trying to use Inline-code to call Page_load, Page_Init or
> Page_PreRender
> methods.
>
> I've also got a code behind c#-file.
>
> I can define inline methods for buttons and so on...that works fine.
> But
> when I try to call Page_load, Page_Init or Page_PreRender methods it
> doesn't
> work.
>
> Non of the methods get's triggered !?
>
> How can I solve this problem with combining code behind and
> inline-code?
> I just need an action to call my own defined dll-call, it must be
done in
> inlin -code!
>
> Regards
> /Anders
>
>
>
>
>
>
>



Nov 19 '05 #5

P: n/a
Hmmmm...
It works when I remove AutoEventWireup="false" from the aspx-page??

Anyone knows why?
/Anders

"Anders M" <it*****@du.se> skrev i meddelandet
news:%2****************@TK2MSFTNGP09.phx.gbl...


For me the inline Page_Load don't fire!
If I remove <@Page Language="c#" codebehind="WebForm1.aspx.cs".......> The
Inline code fires!

Else only the codebehind code.

/Anders


"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
skrev i meddelandet news:uy**************@TK2MSFTNGP10.phx.gbl...
I guess I still don't understand..

Given the following inline:

<script language="C#" runat="server">
void Page_Load(object sender, EventArgs e){
Response.Write("1");
}
</script>

and the following codebehind:

private void Page_Load(object sender, EventArgs e)
{
Response.Write("2");
}

both events will fire....

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Anders M" <it*****@du.se> wrote in message
news:Oc***************@TK2MSFTNGP10.phx.gbl...
Because I don't have access to the code behind file! I'm modifying an
.ascx-file that's using several dll's made third part developers.

Maybe I can make a dll and override Page_Load event?
/Anders

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> skrev i meddelandet news:uz******************@TK2MSFTNGP12.phx.gbl...
> Anders:
> I can't see why you HAVE to use both..that doesn't really make sense to me.
> Why not just create a function called "Initialize()" in codebehind which you
> can call in the inline page_load event?
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to> come!)
>
>
> "Anders M" <it*****@du.se> wrote in message
> news:eO**************@tk2msftngp13.phx.gbl...
> > I'm trying to use Inline-code to call Page_load, Page_Init or
> > Page_PreRender
> > methods.
> >
> > I've also got a code behind c#-file.
> >
> > I can define inline methods for buttons and so on...that works fine.> > But
> > when I try to call Page_load, Page_Init or Page_PreRender methods it> > doesn't
> > work.
> >
> > Non of the methods get's triggered !?
> >
> > How can I solve this problem with combining code behind and
> > inline-code?
> > I just need an action to call my own defined dll-call, it must be done in
> > inlin -code!
> >
> > Regards
> > /Anders
> >
> >
> >
> >
> >
> >
> >
>
>



Nov 19 '05 #6

P: n/a
Yes, AutoEventWireUp automatically wires events based on their name...so it
seems a function Page_Load and automatically hooks it into the OnLoage event
of the page...inline works like that (and only like that)....

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Anders M" <it*****@du.se> wrote in message
news:ej**************@TK2MSFTNGP14.phx.gbl...
Hmmmm...
It works when I remove AutoEventWireup="false" from the aspx-page??

Anyone knows why?
/Anders

"Anders M" <it*****@du.se> skrev i meddelandet
news:%2****************@TK2MSFTNGP09.phx.gbl...


For me the inline Page_Load don't fire!
If I remove <@Page Language="c#" codebehind="WebForm1.aspx.cs".......>
The
Inline code fires!

Else only the codebehind code.

/Anders


"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
skrev i meddelandet news:uy**************@TK2MSFTNGP10.phx.gbl...
> I guess I still don't understand..
>
> Given the following inline:
>
> <script language="C#" runat="server">
> void Page_Load(object sender, EventArgs e){
> Response.Write("1");
> }
> </script>
>
> and the following codebehind:
>
> private void Page_Load(object sender, EventArgs e)
> {
> Response.Write("2");
> }
>
> both events will fire....
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is
> annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
> "Anders M" <it*****@du.se> wrote in message
> news:Oc***************@TK2MSFTNGP10.phx.gbl...
> > Because I don't have access to the code behind file! I'm modifying an
> > .ascx-file that's using several dll's made third part developers.
> >
> > Maybe I can make a dll and override Page_Load event?
> > /Anders
> >
> >
> >
> > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> > > skrev i meddelandet news:uz******************@TK2MSFTNGP12.phx.gbl...
> >> Anders:
> >> I can't see why you HAVE to use both..that doesn't really make sense to > > me.
> >> Why not just create a function called "Initialize()" in codebehind

which
> > you
> >> can call in the inline page_load event?
> >>
> >> Karl
> >>
> >> --
> >> MY ASP.Net tutorials
> >> http://www.openmymind.net/ - New and Improved (yes, the popup is
> >> annoying)
> >> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to > >> come!)
> >>
> >>
> >> "Anders M" <it*****@du.se> wrote in message
> >> news:eO**************@tk2msftngp13.phx.gbl...
> >> > I'm trying to use Inline-code to call Page_load, Page_Init or
> >> > Page_PreRender
> >> > methods.
> >> >
> >> > I've also got a code behind c#-file.
> >> >
> >> > I can define inline methods for buttons and so on...that works fine. > >> > But
> >> > when I try to call Page_load, Page_Init or Page_PreRender methods it > >> > doesn't
> >> > work.
> >> >
> >> > Non of the methods get's triggered !?
> >> >
> >> > How can I solve this problem with combining code behind and
> >> > inline-code?
> >> > I just need an action to call my own defined dll-call, it must be

done
> > in
> >> > inlin -code!
> >> >
> >> > Regards
> >> > /Anders
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> >>
> >
> >
>
>



Nov 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.