Question regarding 'GetPostBackEventReference' and multiple arguments
-
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 -
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 HayesHi, 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
-
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
-
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.
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
-
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