ScriptManager in MasterPage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krungkrung
    New Member
    • Nov 2008
    • 18

    #16
    Hi Frinny! Thanks..thanks!

    Sorry if I did not clearly explain my last post....:)


    What I mean by placing my LoadAllPhotos() function to a Base Class is, instead of placing it to current .aspx page, I want to place it in another Class(which inherits System.Web.UI.P age) and my .aspx page will just inherit that class, so I can call LoadAllPhotos from my JavaScript using PageMethods of ASP.Net AJAX...but as what youve said, it is not possible to pass Page param to javascript, so I should not be wasting my time thinking of this, I guess..:).

    Sorry If I used 'transition' in my last post. What I really meant was, calling JavaScript function from Code Behind and calling Code Behind function from JavaScript. Btw, this is the only way(method) I know to change my page's content without posting back..or should I say, without making the entire page refreshed like when you press the 'Refresh' btn of the browser. Thanks Frinny!

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #17
      Originally posted by krungkrung
      What I mean by placing my LoadAllPhotos() function to a Base Class is, instead of placing it to current .aspx page, I want to place it in another Class(which inherits System.Web.UI.P age) and my .aspx page will just inherit that class, so I can call LoadAllPhotos from my JavaScript using PageMethods of ASP.Net AJAX...but as what youve said, it is not possible to pass Page param to javascript, so I should not be wasting my time thinking of this, I guess..:).
      No no it's not a waste of time...you have the right idea, you're just going about it the wrong way.

      You should into putting the LoadAllPhotos into a Web Service. You can call the Web Service using the AJAX.NET Library.

      When you talk about "Base Class" I automatically think "inheritance".. ..and I never did understand why people want to use inheritance in aspx pages.....they' re just pages....they don't require something like: Animal(BaseObje ct)->Cat(Derived From Animal)->HouseCat(Deriv ed from Cat).

      The Web Services solution is actually a pretty good idea :) I've never done it with pictures before but I think it should work! Even if the web service simply returns a bunch of URL's to the pictures...you can dynamically create the HTML <img> tags to display the images which may be quicker than loading all of the images at the same time.

      Originally posted by krungkrung
      What I really meant was, calling JavaScript function from Code Behind
      You cannot call a JavaScript function from your C# code....because the JavaScript function executes in the web browser, whereas the C# code is executed on the server.

      Using Ajax you can make a request to execute C# code, but the C# code can't call the JavaScript function. (Unless you want to use COMET...but I wouldn't recommend it until you have a clear understanding of JavaScript and AJAX)

      Originally posted by krungkrung
      Btw, this is the only way(method) I know to change my page's content without posting back..or should I say, without making the entire page refreshed like when you press the 'Refresh' btn of the browser.
      Not sure what you're talking about here....are you using an UpdatePanel?

      -Frinny

      Comment

      Working...