locked
call method of another class RRS feed

  • Question

  • User-48059333 posted

    i have webusercontrol in masterpage and i need to call method of that control from another class which is content page's class of that master page. pls tell me how can i do that in asp.net

    Tuesday, December 4, 2007 2:02 PM

Answers

  • User214117797 posted

    i have webusercontrol in masterpage and i need to call method of that control from another class which is content page's class of that master page. pls tell me how can i do that in asp.net
     

    You will either need to 

    a. instantiation the class OR

    b. make the class static so you can just access it methods

    c. add the class to Session/Cache so you can just use it 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 4, 2007 4:14 PM
  • User-295272258 posted

     if u r using asp.net 1.x then u can simply instantiate class and can invoke method

    but

    if u r using asp.net 2.x or onwards then u would need to call that thru reflection  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 24, 2007 10:50 AM

All replies

  • User214117797 posted

    i have webusercontrol in masterpage and i need to call method of that control from another class which is content page's class of that master page. pls tell me how can i do that in asp.net
     

    You will either need to 

    a. instantiation the class OR

    b. make the class static so you can just access it methods

    c. add the class to Session/Cache so you can just use it 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, December 4, 2007 4:14 PM
  • User-295272258 posted

     if u r using asp.net 1.x then u can simply instantiate class and can invoke method

    but

    if u r using asp.net 2.x or onwards then u would need to call that thru reflection  

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 24, 2007 10:50 AM