Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

dynamic call of  a function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pelegk1 - 22 Sep 2007 06:38 GMT
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 - 22 Sep 2007 08:07 GMT
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.

> how can i call a function
> where i recive its name from a query string and i want to call that
[quoted text clipped - 4 lines]
> thnaks in advance
> peleg
pelegk1 - 22 Sep 2007 09:12 GMT
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?

> 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
[quoted text clipped - 9 lines]
> > thnaks in advance
> > peleg
IfThenElse - 22 Sep 2007 19:30 GMT
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..

>i agree with that 100% !
> the problem is hat the client side was wrote long ago and know i cant
[quoted text clipped - 18 lines]
>> > thnaks in advance
>> > peleg
pelegk1 - 23 Sep 2007 08:20 GMT
wow i thought its easy like in asp :)
do u have mabye a link to an example?
thanks alot
peleg

> string methodToCall = "TheFunctionOrMethodNameToCallDynamicall";
> Return CType(Me.GetType().InvokeMember(methodToCall, BindingFlags.Instance
[quoted text clipped - 31 lines]
> >> > thnaks in advance
> >> > peleg
IfThenElse - 25 Sep 2007 21:52 GMT
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....

> wow i thought its easy like in asp :)
> do u have mabye a link to an example?
[quoted text clipped - 39 lines]
>> >> > thnaks in advance
>> >> > peleg

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.