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. Web Development
  3. ASP.NET
  4. Question regarding 'GetPostBackEventReference' and multiple arguments

Question regarding 'GetPostBackEventReference' and multiple arguments

Scheduled Pinned Locked Moved ASP.NET
questioncsharpjavascriptasp-netsysadmin
5 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.
  • L Offline
    L Offline
    Lea Hayes
    wrote on last edited by
    #1

    Hi guys, In my ASP.NET website I have several custom controls which make use of the Page.ClientScript.GetPostBackEventReference method to achieve postbacks from client javascript. Up until now this has worked like a charm, however I find myself with a difficulty. GetPostBackEventReference generates a reference which allows one control reference and one argument to be passed from the client to the server. Is there already a mechanism in place to parse multiple arguments from the client to the server? It isn't the end of the world if there isn't because I could manually parse a single string into multiple arguments. Many thanks! Lea Hayes

    L 1 Reply Last reply
    0
    • L Lea Hayes

      Hi guys, In my ASP.NET website I have several custom controls which make use of the Page.ClientScript.GetPostBackEventReference method to achieve postbacks from client javascript. Up until now this has worked like a charm, however I find myself with a difficulty. GetPostBackEventReference generates a reference which allows one control reference and one argument to be passed from the client to the server. Is there already a mechanism in place to parse multiple arguments from the client to the server? It isn't the end of the world if there isn't because I could manually parse a single string into multiple arguments. Many thanks! Lea Hayes

      L Offline
      L Offline
      Lea Hayes
      wrote on last edited by
      #2

      Hi, I have worked out a slightly different way of achieving what I need. Instead of manually adjusting the postback reference I have just realized that I can use hidden fields to achieve what I need. For those interested, 1. I register the hidden field via

      Page.ClientScript.RegisterHiddenField("MyFieldName", "InitialValue");

      . 2. This value can then be altered by javascript

      document.getElementById('MyFieldName').value = 'AdjustedValue';

      3. Then this value can be retrieved again on the server by:

      string requestedValue = Page.Request.Form["MyFieldName"];

      And that's all there was to it! Thanks anyhow, Lea Hayes

      N 1 Reply Last reply
      0
      • L Lea Hayes

        Hi, I have worked out a slightly different way of achieving what I need. Instead of manually adjusting the postback reference I have just realized that I can use hidden fields to achieve what I need. For those interested, 1. I register the hidden field via

        Page.ClientScript.RegisterHiddenField("MyFieldName", "InitialValue");

        . 2. This value can then be altered by javascript

        document.getElementById('MyFieldName').value = 'AdjustedValue';

        3. Then this value can be retrieved again on the server by:

        string requestedValue = Page.Request.Form["MyFieldName"];

        And that's all there was to it! Thanks anyhow, Lea Hayes

        N Offline
        N Offline
        nyeboy
        wrote on last edited by
        #3

        If you want to get client values,there are four methods. one is ViewState,two hidden control,three session,four request.query or request.form.

        studing is processing in this life.

        L 1 Reply Last reply
        0
        • N nyeboy

          If you want to get client values,there are four methods. one is ViewState,two hidden control,three session,four request.query or request.form.

          studing is processing in this life.

          L Offline
          L Offline
          Lea Hayes
          wrote on last edited by
          #4

          Hi, Thank you for your advice...would you be able to demonstrate how to access the view state object from the client script language? I was under the impression that the view state was not accessible by the client because it is encrypted, and compressed. I would also be interested in an example for the accessing session information via the client. I understand how the hidden controls, request.query, and request.forms alternatives work. Thanks! Lea Hayes

          N 1 Reply Last reply
          0
          • L Lea Hayes

            Hi, Thank you for your advice...would you be able to demonstrate how to access the view state object from the client script language? I was under the impression that the view state was not accessible by the client because it is encrypted, and compressed. I would also be interested in an example for the accessing session information via the client. I understand how the hidden controls, request.query, and request.forms alternatives work. Thanks! Lea Hayes

            N Offline
            N Offline
            nyeboy
            wrote on last edited by
            #5

            In fact,ViewState is the same as Session. button1_click() { ViewState["test"]=TextBox1.text; string temp=ViewState["test"]; Response.write(temp); }

            studing is processing in this life.

            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