Calling other functions

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Calling other functions

    All,

    Using .NET 1.1, I have built a custom control, however I am having trouble
    compiling it.
    For the on click event of the button, I want it to run a function that is
    already on my aspx page.
    As the .NET compiler cannot see this page / function at compile time, does
    anyone know of a way I can call the underlying function.

    private void ibLogIn_Click( object item, ImageClickEventArgs args )

    {

    HttpContext.Current.Session["LoggedInAs"] = tbUsername.Text;

    SystemLogin(tbUsername.ToString(), tbPassword.ToString());

    }

    In this case, it's the systemlogin procedure I'm trying to call.

    Cheers

    Tony


    Tony Doyle Guest

  2. Similar Questions and Discussions

    1. Calling functions from main.asc
      hi all, i'm new to flash com server ... made the following example to explain what i'm trying to do... the bottom line is that i want to forexample...
    2. calling functions with include
      suppose i have... <?php include("common_functions.php"); fxn1(); fxn2(); ?> i want fxn1 and fxn2 to be on the common_functions.php page,...
    3. Calling functions between frames...
      JavaScript can not run on server side. You can include it in the output of your PHP script. "Albert Finchly" <Albert_Finchly@Yahoo.co.uk>...
    4. Calling functions?
      Hello, I wrote a jscript function within the HTML window of my webpage and would like to call it from inside the ASPX code-behind page. Any...
    5. calling functions
      how do i call a vbscript function (which is between <%%>) from a vbscript script function (which is between script tags-<script...
  3. #2

    Default Re: Calling other functions

    Controls shouldn't be tightly coupled with the page on which they are
    hosted.
    Calling the SystemLogin function may work well for now, but what happens
    when you put the control onto another page that doesn't have that function?
    It will blow up, that's what! If your response is that you don't ever plan
    to put the control onto another page then I'd have to question the wisdom of
    creating this functionality as a control in the first place.

    Generally it is better for controls to raise events to the page on which
    they are hosted, then the page can respond appropriately.
    Here's more info:
    [url]http://SteveOrr.net/faq/PassDataFromUserControl.aspx[/url]

    --
    I hope this helps,
    Steve C. Orr,
    MCSD, MVP, CSM, ASPInsider
    [url]http://SteveOrr.net[/url]


    "Tony Doyle" <nospam@spamoff.com> wrote in message
    news:u1BJgwiEHHA.1220@TK2MSFTNGP04.phx.gbl...
    > All,
    >
    > Using .NET 1.1, I have built a custom control, however I am having trouble
    > compiling it.
    > For the on click event of the button, I want it to run a function that is
    > already on my aspx page.
    > As the .NET compiler cannot see this page / function at compile time, does
    > anyone know of a way I can call the underlying function.
    >
    > private void ibLogIn_Click( object item, ImageClickEventArgs args )
    >
    > {
    >
    > HttpContext.Current.Session["LoggedInAs"] = tbUsername.Text;
    >
    > SystemLogin(tbUsername.ToString(), tbPassword.ToString());
    >
    > }
    >
    > In this case, it's the systemlogin procedure I'm trying to call.
    >
    > Cheers
    >
    > Tony
    >
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider] Guest

  4. #3

    Default Re: Calling other functions

    Steve,

    You are right in what you suggest, I have inherited this app from a long
    departed developer, so was looking for a way round what he had done.
    As it happens, the SystemLogin function is inherited from a separate class
    module inside the asp.net application, so I am not expecting it to "blow up"
    because of that.
    I have found a way to do it, using references,

    Thanks

    Td


    "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]" <Steve@Orr.net> wrote in
    message news:FDFD3628-1B4F-4E89-8AC7-CB244A7B4460@microsoft.com...
    > Controls shouldn't be tightly coupled with the page on which they are
    > hosted.
    > Calling the SystemLogin function may work well for now, but what happens
    > when you put the control onto another page that doesn't have that
    > function? It will blow up, that's what! If your response is that you
    > don't ever plan to put the control onto another page then I'd have to
    > question the wisdom of creating this functionality as a control in the
    > first place.
    >
    > Generally it is better for controls to raise events to the page on which
    > they are hosted, then the page can respond appropriately.
    > Here's more info:
    > [url]http://SteveOrr.net/faq/PassDataFromUserControl.aspx[/url]
    >
    > --
    > I hope this helps,
    > Steve C. Orr,
    > MCSD, MVP, CSM, ASPInsider
    > [url]http://SteveOrr.net[/url]
    >
    >
    > "Tony Doyle" <nospam@spamoff.com> wrote in message
    > news:u1BJgwiEHHA.1220@TK2MSFTNGP04.phx.gbl...
    >> All,
    >>
    >> Using .NET 1.1, I have built a custom control, however I am having
    >> trouble compiling it.
    >> For the on click event of the button, I want it to run a function that is
    >> already on my aspx page.
    >> As the .NET compiler cannot see this page / function at compile time,
    >> does anyone know of a way I can call the underlying function.
    >>
    >> private void ibLogIn_Click( object item, ImageClickEventArgs args )
    >>
    >> {
    >>
    >> HttpContext.Current.Session["LoggedInAs"] = tbUsername.Text;
    >>
    >> SystemLogin(tbUsername.ToString(), tbPassword.ToString());
    >>
    >> }
    >>
    >> In this case, it's the systemlogin procedure I'm trying to call.
    >>
    >> Cheers
    >>
    >> Tony
    >>
    >

    Tony Doyle Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139