Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Calling function from one webpage to another

Calling function from one webpage to another

Scheduled Pinned Locked Moved C#
helpquestion
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    grewin
    wrote on last edited by
    #1

    How can in WebForm1 the function in WebForm2? i try WebForm2. and look up for other overloads, but i get view the function. Any one can help. A big thanks!

    G K S A 4 Replies Last reply
    0
    • G grewin

      How can in WebForm1 the function in WebForm2? i try WebForm2. and look up for other overloads, but i get view the function. Any one can help. A big thanks!

      G Offline
      G Offline
      Gareth H
      wrote on last edited by
      #2

      ewin, You might get more help asking this in the ASP.NET forum.

      Regards, Gareth. (FKA gareth111)

      1 Reply Last reply
      0
      • G grewin

        How can in WebForm1 the function in WebForm2? i try WebForm2. and look up for other overloads, but i get view the function. Any one can help. A big thanks!

        K Offline
        K Offline
        koleraba
        wrote on last edited by
        #3

        I am not shure I understand the question corretly. But in asp.net pages, a Form is loaded(Form1 in your example), when user requests this page. So there will be no instance of Form2. If you have to call methods from Form2 I think you will have to use static methods I hope this helps!

        1 Reply Last reply
        0
        • G grewin

          How can in WebForm1 the function in WebForm2? i try WebForm2. and look up for other overloads, but i get view the function. Any one can help. A big thanks!

          S Offline
          S Offline
          SomeGuyThatIsMe
          wrote on last edited by
          #4

          doesnt sound like the best idea, you can however put the functions in a new util class in the same namespace or namespace.Util and inlcude that in your using statements(if you use the .util one) and access that functions that way, it makes life easier 6 months down the road when you have to change a method in form 2 you wont have to worry about where else it might be called at, but you know the util class would be used in other places so debuging may be easier for you. and if for some reason you change what form 2 does or replace your function and delete it, you wont accidently break another form you werent changing, this happened to a dev we had working here a few times then he finally took my advice after he couldnt figure out what was going on, now the code behind pages are clearer, and it forced him to start thinking about how to do things generically instead of copying the same function to 15 different files... hope it helps.

          Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          1 Reply Last reply
          0
          • G grewin

            How can in WebForm1 the function in WebForm2? i try WebForm2. and look up for other overloads, but i get view the function. Any one can help. A big thanks!

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            ewin wrote:

            How can in WebForm1 the function in WebForm2?

            This is not the asp.net forum , please put it over ther. Try to create separete class for accessing same function

            Best Regards ----------------- Abhijit Jana Check Out My Latest Article Java.NET : Integration of Java and .NET[^] "Success is Journey it's not a destination"

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups