dynamic call of a function

Discussion in 'ASP .Net' started by =?Utf-8?B?cGVsZWdrMQ==?=, Sep 22, 2007.

  1. how can i call a function
    where i recive its name from a query string and i want to call that function
    (in asp it was with Eval function)
    and how can i call it if i have parameters too?

    thnaks in advance
    peleg
     
    =?Utf-8?B?cGVsZWdrMQ==?=, Sep 22, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?cGVsZWdrMQ==?=

    Forum Guest

    It is not a good thing to mention your fully functions in the querystring.
    It´s better to pass a string by the querystring and in the page_load event
    get that string and do the right action then. Also you can put parameters in
    the querystring and get them in the same event.


    "pelegk1" <> schreef in bericht
    news:...
    > how can i call a function
    > where i recive its name from a query string and i want to call that
    > function
    > (in asp it was with Eval function)
    > and how can i call it if i have parameters too?
    >
    > thnaks in advance
    > peleg
    >
     
    Forum, Sep 22, 2007
    #2
    1. Advertising

  3. i agree with that 100% !
    the problem is hat the client side was wrote long ago and know i cant change
    it
    so how can i call a function dynamiclly?

    "Forum" wrote:

    > It is not a good thing to mention your fully functions in the querystring.
    > It´s better to pass a string by the querystring and in the page_load event
    > get that string and do the right action then. Also you can put parameters in
    > the querystring and get them in the same event.
    >
    >
    > "pelegk1" <> schreef in bericht
    > news:...
    > > how can i call a function
    > > where i recive its name from a query string and i want to call that
    > > function
    > > (in asp it was with Eval function)
    > > and how can i call it if i have parameters too?
    > >
    > > thnaks in advance
    > > peleg
    > >

    >
     
    =?Utf-8?B?cGVsZWdrMQ==?=, Sep 22, 2007
    #3
  4. =?Utf-8?B?cGVsZWdrMQ==?=

    IfThenElse Guest

    string methodToCall = "TheFunctionOrMethodNameToCallDynamicall";
    Return CType(Me.GetType().InvokeMember(methodToCall, BindingFlags.Instance
    Or BindingFlags.Public Or _

    BindingFlags.InvokeMethod, Nothing, Me, New Object()
    {SomeParameterYouArePassing_Id, SecondParameterEtcAndThirdCommaDelimited}),
    Byte())



    In this case I am invoking, Dynamically, a function that returns a Byte()
    Array.



    Etc..



    "pelegk1" <> wrote in message
    news:...
    >i agree with that 100% !
    > the problem is hat the client side was wrote long ago and know i cant
    > change
    > it
    > so how can i call a function dynamiclly?
    >
    > "Forum" wrote:
    >
    >> It is not a good thing to mention your fully functions in the
    >> querystring.
    >> It´s better to pass a string by the querystring and in the page_load
    >> event
    >> get that string and do the right action then. Also you can put parameters
    >> in
    >> the querystring and get them in the same event.
    >>
    >>
    >> "pelegk1" <> schreef in bericht
    >> news:...
    >> > how can i call a function
    >> > where i recive its name from a query string and i want to call that
    >> > function
    >> > (in asp it was with Eval function)
    >> > and how can i call it if i have parameters too?
    >> >
    >> > thnaks in advance
    >> > peleg
    >> >

    >>
     
    IfThenElse, Sep 22, 2007
    #4
  5. wow i thought its easy like in asp :)
    do u have mabye a link to an example?
    thanks alot
    peleg

    "IfThenElse" wrote:

    >
    > string methodToCall = "TheFunctionOrMethodNameToCallDynamicall";
    > Return CType(Me.GetType().InvokeMember(methodToCall, BindingFlags.Instance
    > Or BindingFlags.Public Or _
    >
    > BindingFlags.InvokeMethod, Nothing, Me, New Object()
    > {SomeParameterYouArePassing_Id, SecondParameterEtcAndThirdCommaDelimited}),
    > Byte())
    >
    >
    >
    > In this case I am invoking, Dynamically, a function that returns a Byte()
    > Array.
    >
    >
    >
    > Etc..
    >
    >
    >
    > "pelegk1" <> wrote in message
    > news:...
    > >i agree with that 100% !
    > > the problem is hat the client side was wrote long ago and know i cant
    > > change
    > > it
    > > so how can i call a function dynamiclly?
    > >
    > > "Forum" wrote:
    > >
    > >> It is not a good thing to mention your fully functions in the
    > >> querystring.
    > >> It´s better to pass a string by the querystring and in the page_load
    > >> event
    > >> get that string and do the right action then. Also you can put parameters
    > >> in
    > >> the querystring and get them in the same event.
    > >>
    > >>
    > >> "pelegk1" <> schreef in bericht
    > >> news:...
    > >> > how can i call a function
    > >> > where i recive its name from a query string and i want to call that
    > >> > function
    > >> > (in asp it was with Eval function)
    > >> > and how can i call it if i have parameters too?
    > >> >
    > >> > thnaks in advance
    > >> > peleg
    > >> >
    > >>

    >
    >
    >
     
    =?Utf-8?B?cGVsZWdrMQ==?=, Sep 23, 2007
    #5
  6. =?Utf-8?B?cGVsZWdrMQ==?=

    IfThenElse Guest

    This is an example.

    string methodToCall = "TheFunctionOrMethodNameToCallDynamicall"; // put
    the function name you want to call here.

    Return CType(Me.GetType().InvokeMember(methodToCall, BindingFlags.Instance
    Or BindingFlags.Public Or BindingFlags.InvokeMethod,
    Nothing, Me, New Object()
    {SomeParameterYouArePassing_Id,
    SecondParameterEtcAndThirdCommaDelimited}), Byte())

    This is where you pass the parameters if you have any.
    {SomeParameterYouArePassing_Id, SecondParameterEtcAndThirdCommaDelimited}),

    The function you are calling is withing the same class hence
    Me.GetType().etc.....

    read more about the flags for the method above....




    "pelegk1" <> wrote in message
    news:D...
    > wow i thought its easy like in asp :)
    > do u have mabye a link to an example?
    > thanks alot
    > peleg
    >
    > "IfThenElse" wrote:
    >
    >>
    >> string methodToCall = "TheFunctionOrMethodNameToCallDynamicall";
    >> Return CType(Me.GetType().InvokeMember(methodToCall,
    >> BindingFlags.Instance
    >> Or BindingFlags.Public Or _
    >>
    >> BindingFlags.InvokeMethod, Nothing, Me, New Object()
    >> {SomeParameterYouArePassing_Id,
    >> SecondParameterEtcAndThirdCommaDelimited}),
    >> Byte())
    >>
    >>
    >>
    >> In this case I am invoking, Dynamically, a function that returns a Byte()
    >> Array.
    >>
    >>
    >>
    >> Etc..
    >>
    >>
    >>
    >> "pelegk1" <> wrote in message
    >> news:...
    >> >i agree with that 100% !
    >> > the problem is hat the client side was wrote long ago and know i cant
    >> > change
    >> > it
    >> > so how can i call a function dynamiclly?
    >> >
    >> > "Forum" wrote:
    >> >
    >> >> It is not a good thing to mention your fully functions in the
    >> >> querystring.
    >> >> It´s better to pass a string by the querystring and in the page_load
    >> >> event
    >> >> get that string and do the right action then. Also you can put
    >> >> parameters
    >> >> in
    >> >> the querystring and get them in the same event.
    >> >>
    >> >>
    >> >> "pelegk1" <> schreef in bericht
    >> >> news:...
    >> >> > how can i call a function
    >> >> > where i recive its name from a query string and i want to call that
    >> >> > function
    >> >> > (in asp it was with Eval function)
    >> >> > and how can i call it if i have parameters too?
    >> >> >
    >> >> > thnaks in advance
    >> >> > peleg
    >> >> >
    >> >>

    >>
    >>
    >>
     
    IfThenElse, Sep 25, 2007
    #6
    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. grbgooglefan
    Replies:
    2
    Views:
    449
    Pascal Bourguignon
    Jan 30, 2008
  2. grbgooglefan
    Replies:
    4
    Views:
    465
    Kenny McCormack
    Jan 30, 2008
  3. grbgooglefan
    Replies:
    0
    Views:
    416
    grbgooglefan
    Jan 30, 2008
  4. Alok
    Replies:
    3
    Views:
    279
  5. THAKUR PRASHANT SINGH

    Class Function call vs Normal Function call

    THAKUR PRASHANT SINGH, Feb 26, 2010, in forum: Ruby
    Replies:
    7
    Views:
    211
    THAKUR PRASHANT SINGH
    Feb 27, 2010
Loading...

Share This Page