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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Callback & Masterpage

Callback & Masterpage

Scheduled Pinned Locked Moved ASP.NET
javascriptsysadminquestion
4 Posts 2 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.
  • S Offline
    S Offline
    sbao004
    wrote on last edited by
    #1

    Hi, I'm trying to use callback function to send a randon number to the client. My code works on a normal page, but not on a page with Masterpage. My JavaScript is: //To call the function in the Server function GetNumber() { UseCallBack(); } // To retrive the value from the server to display it in the TextBox1 function GetRandomNumberFromServer(arg, context) { document.cforms[0].TextBox1.value = arg; } So is there anything I should change? Thanks, Si Jia

    M 1 Reply Last reply
    0
    • S sbao004

      Hi, I'm trying to use callback function to send a randon number to the client. My code works on a normal page, but not on a page with Masterpage. My JavaScript is: //To call the function in the Server function GetNumber() { UseCallBack(); } // To retrive the value from the server to display it in the TextBox1 function GetRandomNumberFromServer(arg, context) { document.cforms[0].TextBox1.value = arg; } So is there anything I should change? Thanks, Si Jia

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      What do you mean by it's not working on the web page using MasterPage? Is that the problem of accessing the textbox element? If so, you may need to view source the web page to have an idea about the id of the textbox at the client side.

      S 1 Reply Last reply
      0
      • M minhpc_bk

        What do you mean by it's not working on the web page using MasterPage? Is that the problem of accessing the textbox element? If so, you may need to view source the web page to have an idea about the id of the textbox at the client side.

        S Offline
        S Offline
        sbao004
        wrote on last edited by
        #3

        Cool. Thank you so much After I View the source code during the runtime, I find the ID of the textbox. The ID of the textbox is "ctl00$ContentPlaceHolder1$TextBox1" The name of the textbox is just TextBox1 and the "ct100" I don't know what it means but it's just there. Just in case someone has the same problem with me. Cheers,

        M 1 Reply Last reply
        0
        • S sbao004

          Cool. Thank you so much After I View the source code during the runtime, I find the ID of the textbox. The ID of the textbox is "ctl00$ContentPlaceHolder1$TextBox1" The name of the textbox is just TextBox1 and the "ct100" I don't know what it means but it's just there. Just in case someone has the same problem with me. Cheers,

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          The ctl00 is the ID of the master page instance at runtime, you can set the Trace="true" in the Page directive, browse the web page and look at the control tree section that may give you some information.

          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