Get values from javascript array using vb.net

Posted on 2010-01-03
Medium Priority
Last Modified: 2013-11-07
I am  using javascript array and want to read the value of the array using vb.net code behind
Question by:dba_damion
LVL 36

Expert Comment

by:Miguel Oz
ID: 26167875
If you are using asp.net use:


Expert Comment

ID: 26168316
hi dba_damion,

As per my understanding, your requirement is to read the client-side value (javascript array) in the server-side (using vb.net code behind).. if so, as per my knowledge... we can't directly read a client-side value in the server-side.

My suggestion is that, put that javascript array to a hidden field (server side) and read the value from that hidden field control.

Author Comment

ID: 26168459
My main goal is to make a form using vb.net and aspx that will allow the user to populate the form (using next , previous , process all button) with out posting the value back to the server each time . I want them to only send a batch of data to the server when they hit the process all button
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

LVL 36

Expert Comment

by:Miguel Oz
ID: 26168840
Ok, if that is the case,
Alternative 1:
You do not need an array, you only have 3 values that you can send as a parameters of a query string.
In js call your your page like 1.aspx?next=v1&previous=v2&process=v3"
In vb.net access page_load event access Request property (Request["next"].ToString())

Alternative 2: A lot of work for no real gain.
In java script:
you still need to convert your js array into comma separated values (arrayStr = p1,p2,p3)
and assigned as query string like 1.aspx?file=" + arrayStr
In your page_load event:
string[] files = Request["file"].ToString().Split(',');
ArrayList arry = new ArrayList();
foreach (string file in files)

Let me know which solution fits you. I can translate the code to Vb.net if required.


Author Comment

ID: 26175104
I found another way to go is using Ajax components with script manager.  This will be best for me but I am not sure how to use this . I want to insert data in the top part of the page while the grid is updated with out reloading the page can someone help

Expert Comment

ID: 26175999
Hey damion, I've worked on a similar issue using .net callbacks which is similar to Ajax. If i understand what you're trying to do,  you want to be able to asynchronously (without a postback or page refresh) send data from the Equipment, Revenue Date, etc. fields to the server and then get data back to the server which will then be used to update the grid? But to have this all operate seamlessly so the user doesn't feel they've gone from one page to the next?  If that's what you're trying to do Callbacks will help, it's a lot like Ajax but you have to some of the coding manually that Ajax abstracts away. But it does give you full control. Are you committed to strictly using Ajax?

Accepted Solution

dba_damion earned 0 total points
ID: 26382000
I figured it out updatepanel in vs2005 did the trick

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month16 days, 3 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question