Calling code-behind function from in-line code page

Discussion in 'ASP .Net' started by Fred Armitage, Aug 26, 2003.

  1. I have a fairly complex application written using a vb code-behind dll.
    However, I'd like to write one particular aspx page utilising in-line code
    so that it can easily be modified as needed by the end user, and yet still
    utilise some functions in the code-behind dll.
    Is this possible? (How?)
    Fred Armitage, Aug 26, 2003
    #1
    1. Advertising

  2. Fred,

    I'm not 100% positive but I don't think you can do this. To use the
    codebehind file or inline code you change the page directive's
    AutoEventWireup attribute. Since it has to be set to true or false I think
    you can only use one or the other.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "Fred Armitage" <> wrote in message
    news:bifrbm$bla$1$...
    > I have a fairly complex application written using a vb code-behind dll.
    > However, I'd like to write one particular aspx page utilising in-line code
    > so that it can easily be modified as needed by the end user, and yet still
    > utilise some functions in the code-behind dll.
    > Is this possible? (How?)
    >
    >
    >
    S. Justin Gengo, Aug 26, 2003
    #2
    1. Advertising

  3. I disagree. It is possible to use code behind and inline code at the same
    time. Setting AutoEventWireup to true doesn't prevent events in the parent
    class (in the code behind dll) from getting executed.
    So you develop you code behind dll the normal way, and set AutoEventWireup
    to true to handle page events (like Page_Init and Page_Load) in the aspx
    file.

    or better override the methods that raises these events, for example
    <script language="c#" runat="Server">

    protected override void OnLoad(EventArgs e)
    {
    // here execute the code you want to be executed before the Load event
    is raised
    base.OnLoad(e);
    // here execute the code you want to be executed after the Load event is
    raised
    }
    </script>

    You can also decide not to call base.OnLoad if you don't want the Load event
    to be fired. This gives more flexibility.
    you can also use asp style inline code
    for example
    <table>
    <%
    for(int i = 0; i < 10; i++)
    {
    %>
    <tr>
    <td><%=i%></td>
    <td>Hello World</td>
    </tr>
    <%
    }
    %>
    </table>


    "S. Justin Gengo" <> wrote in message
    news:#76Qi5#...
    > Fred,
    >
    > I'm not 100% positive but I don't think you can do this. To use the
    > codebehind file or inline code you change the page directive's
    > AutoEventWireup attribute. Since it has to be set to true or false I think
    > you can only use one or the other.
    >
    > Sincerely,
    >
    > --
    > S. Justin Gengo, MCP
    > Web Developer
    >
    > Free code library at:
    > www.aboutfortunate.com
    >
    > "Out of chaos comes order."
    > Nietzche
    >
    >
    > "Fred Armitage" <> wrote in message
    > news:bifrbm$bla$1$...
    > > I have a fairly complex application written using a vb code-behind dll.
    > > However, I'd like to write one particular aspx page utilising in-line

    code
    > > so that it can easily be modified as needed by the end user, and yet

    still
    > > utilise some functions in the code-behind dll.
    > > Is this possible? (How?)
    > >
    > >
    > >

    >
    >
    Sherif ElMetainy, Aug 26, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Miller [msft]

    Re: Code Behind vs. no code behind: error

    Ben Miller [msft], Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    569
    Alphonse Giambrone
    Jun 28, 2003
  2. Lachlan Gemmell
    Replies:
    3
    Views:
    556
  3. John

    Non-code behind to code behind

    John, Feb 19, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    466
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 19, 2007
  4. Alexander Kaplunov

    calling JavaScript function from code-behind

    Alexander Kaplunov, Jun 17, 2004, in forum: ASP .Net Web Controls
    Replies:
    7
    Views:
    359
    Fritz
    Jun 19, 2004
  5. Replies:
    1
    Views:
    148
    web.dev
    Sep 25, 2006
Loading...

Share This Page