How to pass values from client side to server side


Is there a way to transfer variable from a client loop to a server loop.
For example:
var clitest = 'test';
Now I would like to get test variable from javascript into a server string variable
<% sertest = ?? %>
I understand that this can be done by storing a variable into a hidden control for example and than access it using server side, but when I have to transfer an array for example it get's a little more complicated. I was wondering is there more efficient approach?
1/10/2005 9:35:25 AM 24353 articles. 1 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 46

You can't transfer arrays, only strings.

To workaround this problem pass delimited string instead of array
1/10/2005 9:44:55 AM
I had used hidden inputs as below :

<INPUT id="ipHidden" type="hidden" value="0" name="ipHidden" runat="server">

and then set the value of the input anywhere in your client side scirpt by saying


The value can be accessed in the serverside code in the same way.
1/10/2005 10:53:49 AM

Similar Artilces:

How to pass the client side values to server side?
 hello to All,Actually i wanna implement a code like... a string in HTML textbox retrieve in server side control....suppose i hv a HTML control <input type="text" id="txtHTML"/>, and dis control  txtHTML.text="abc".now i want to retrieve dis client side string "abc" in d server side textbox named "txtASP"...which hs a property runat="server"so please give me an idea how to pass values from client side to server side.... hope u understand a problem... sam.  You could do this <input type="text"...

passing client side variable value to server side
 i have a grid and  by click on the rows, the onrowclick event is fired on client side. I want to pass the row index to the server side. As there are not sessions variables in javascript so i am stuck to pass the row to the server side.. I have made a texbox and set its valueto the index in the onrowclick event but when refresh calls, the text box became empty as the value set is on client side, i want page to persistthe value,  How can i do that? Tel me some way passing the row index to the server side?? Hi, You can call GridView_SelectedIndexChanging event on row click ev...

how to pass values from client side to server side #2
Hi Guys....               This is Aani....I'm using ASP.NET in C# language.i have created one webpage for get input from user(from java script inputbox).i want that entered data in server side can i pass that value from client side server side.i need proper code in C# language.reply me soon... Thanks is Advanced... Regards....Aani plz use hidden field.ur assing values to text boxes through java script. before post back call a java scipt function to assign value to hodden fieed. even u can add these ...

Problem passing value client-side to server-side
I have a page that calls a pop-up while passing an encrypted value via a query string. The value is encrypted on the parent client-side in javascript so it needs to be decrypted client-side as well. This decryption occurs on closing the child (popup) and I am at a loss of when and how I should get this value to the server-side. On the popup you just want to process server side code? Anytime you can access for example the raw url:string raw = Page.Request.RawUrl;If you need to access any values on the client side you can access the url using javascript. Another idea is to, on the code beh...

How to pass param values from server side to client side scripts
Hi, I have a page containing a datagrid with a list of geographic positions of interesting places. Users can filter this grid. Clicking an item the system displays the place on a map using MS Virtual Earth map component that exposes a client side javascript api. My problem is that the filtering is done on server side, but the map runs on client side. So during page load, I need to create long strings containing complex javascript codes on the server side, and add it as an event handler attribute to my components. This causes a lot of problems, for exemple...

Passing a value from server side to client side without postback
My problem exactly is that on my aspx.vb code-behind, I can update the field using HiddenField ID = "hidSessionTimeout" Code-Behind: on Page_LoadhidSessionTimeout.Value = HttpContext.Current.Session.Timeout on ChangeTimeOutValue()hidSessionTimeout.Value = 5  Client-Side: var x= document.getElementById("hidSessionTimeout"); It seems that the javascript cannot get the latest updated value... Any ideas?    Any Workaround solution? did u keep the page load code in if(!IsPostBack)pavankumar geljian_a:  Client-Side:  var...

Client side code to pass values to server side variable?
Hi there, I have ListBox_SelectedTextChanged() method that creates another list box in the runtime as follows: // Get Action Level List lbxActionLevel = new ListBox();lbxActionLevel.ID = "ddlA" + i.ToString(); lbxActionLevel.Width = 100; lbxActionLevel.Rows = 2;SqlDataReader dr = new BusinessLogicLayer().bllGetActionLevels(); lbxActionLevel.Items.Clear();while (dr.Read()) {ListItem lAction = new ListItem(); lAction.Text = dr.GetString(1).Trim();lAction.Value = Convert.ToString(dr.GetInt32(0)); lbxActionLevel.Items.Add(lAction); lbxActionLevel.SelectedIndex = 0; } I ...

Client Side values to Server Side
What is the best way to transfer Client Side values to the Server side? For example I have a variable "var1" in javascript. var1 = "sample"; How can I acquire this value in the server side?  What is the best approach for this?  Barry to send the value to the server during a postback, you need to place the value in an input control.  You could consider using a hidden textbox for that purpose.Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: In the JavaScrip...

Client-side values to server-side ?
Hi! My previous query is attached below: I have implemented the below mentioned implementation . 'listbox1' on 'webform1' shows all the values from 'webform2'. I have implemented it using javascript. I would like to know that to implement validation on 'webform1', I would require the values of 'listbox1' ,which are on the client-side , to move to the server-side . I think sending a querystring will be fine but how to implement it using javascript and code-behind(C#)? Your suggestion will be appreciated. Thanks and regards, ap.       My previous query: " I am stuck wi...

server side control passing value of self in client side function
I have a server side dropdownlist control.It contains values as:"#00FFFF""#FF00FF""#FFFF00"When the selectedindex is changed by the client I want to assign the value of the dropdownlist to a <div id="example"></div> evelement.pseudo:document.getElementbyId('example').bgcolor=dropdownlist.valueHow can I do this? I think I somehow need to attach a function to my dropdownlist which passes its own value as a parameter to a function...any suggestions?Thanks!please mark answers as 'Answered' and post back solutions when you figure stuff out that isnt in the post already. You ...

How do I pass client side values to server side ones & vice versa
Hi, If I have some jscript that creates a value based on a users input, how can I pass that to a server variable? Many thanks@nt Hi! You can set that value to a hiddenfield (runat = server) on the client and then read it from server side like any other control. If this is not clear, please paste your code so I may help you better.Regards,ClaudioSimplicity: "the art of maximizing the amount of work not done." Thanks for your time crfenix,  I need to do something like below: Code behind:protected void Page_Load(object sender, EventArgs e) {strin...

How can I set client side values as server side values?
Hi, Can anyone tell me how I can get client side values such as document.referrer, navigator.appName etc... into server side scripts? There are some client side values I'd like to set as session vars and insert into the db? How do I go about this? Thanks for any pointers Davlon PS (I'm using powersite Pass them as page parameters, e.g., http://myserver/myurl?document.referrer=whatever&navigator.appName=yadayada Then, in your server-side script, just loop through the document.value array and get these values. -- pbm_hopethishelps, Roy Kie...

Firing both Client side event and server side event for server side button
I am having some difficulties getting this to work.. I have button_click ( and ClientClick (Javascript).  Javascript is firing fine.  Server script is not. may be you have return return false in the in the javascript which is why its not firing server side event.You should add javascript evelt like thisbutton1.onclientclick = "functionname" Function should nopt return false. Vikram www.vikramlakhotia.comPlease mark the answer if it helped you...

Passing variable between client side and server side
For example,how do I pass the return value of the confirm("whatever") to the server side? Or the opposite way.  I want to use a cookie to do is. Can some one give me hint.  Much appreciate your help.   Chen  Please "Mark as an Answer" if you think my post had helped you!Thanks. you can use ajax,javascript and cookies also.  Got what you needed. Please mark as answer. In the aspx file: <input type="hidden" id="confirmAnswer" name="confirmAnswer" runat="server"> That adds this to the...

Web resources about - How to pass values from client side to server side -

Italy of Values - Wikipedia, the free encyclopedia
At European level, the IdV party is member of the European Liberal Democrat and Reform Party (ELDR) and the Alliance of Liberals and Democrats ...

Facebook Is No. 5 on Glassdoor’s Top 25 Companies for Culture & Values
Facebook placed fifth on the 2014 list of Top 25 Companies for Culture & Values from social jobs and career community Glassdoor , which was released ...

Glassdoor: Facebook rated No. 5 nationally in culture, values
Facebook has been highly-rated by its employees for culture and values , coming in at No. 5 overall nationally in a new Glassdoor report . Twitter ...

Gay Family Values (@Depfox) on Twitter
Sign in Sign up You are on Twitter Mobile because you are using an old version of Internet Explorer. Learn more here Gay Family Values @ Depfox ...

Common Lab Values on the App Store on iTunes
Get Common Lab Values on the App Store. See screenshots and ratings, and read customer reviews.

Lila Rose 2009 Values Voter Speech: Part 2 of 2 - YouTube
This speech was given September, 2009 in Washington, DC at the Omni Shoreham Hotel. Lila Rose is the President of Live Action. Learn more about ...

Married Life: For parents, Ramadan is a time to think about values that are passed down
I worry that my 22-month-old baby will grow up thinking Ramadan is all about the food.

Melbourne Storm coach Craig Bellamy values indigenous jerseys
Bellamy says he likes Storm's Indigenous playing strip and would be happy to see it used more.

Tanya Plibersek warns Tony Abbott against using conservative values to dictate foreign aid
Labor is warning Tony Abbott not to let his social conservatism dictate foreign aid by stripping funding from services that provide abortions ...

Migrants must follow Australian values, says Frank Lowy
... boat person who became a shopping centre billionaire, has called on migrants to honour the ''great unwritten deal'' to follow Australian values ...

Resources last updated: 12/12/2015 2:44:29 AM