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. Send a value through Callback to Server [modified]

Send a value through Callback to Server [modified]

Scheduled Pinned Locked Moved ASP.NET
javascripthtmldesignsysadminquestion
1 Posts 1 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 was trying to send a number from a HTML textbox to add a value to it at the Server, then return it to an ASP textbox. But I don't know to to pass the value of the HTML textbox to the server. The 2 Javascript functions are: //the first function to call the server function GetNumber() { UseCallBack(); } // The function receive the adjusted value from the server and display it into the textbox1 function GetRandomNumberFromServer(arg, context) { document.forms[0].TextBox1.value = arg; } Here are the server side code, written in the .vb file: Dim _callbackResult As String = Nothing Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim cbReference As String = Page.ClientScript.GetCallbackEventReference(Me, _ "arg", "GetRandomNumberFromServer", "context") Dim cbScript As String = "function UseCallBack(arg, context) {" & cbReference & "}" Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "UseCallBack", cbScript, True) End Sub Public Function GetCallbackResult() As String Implements System.Web.UI.ICallbackEventHandler.GetCallbackResult Return _callbackResult End Function Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent _callbackResult = 'equal the value from the HTML textbox + 5 End Sub Does anyone know where I can add some code to ask to pass the value to the Server? Thanks, -- modified at 4:30 Tuesday 3rd October, 2006

    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