1

I have this code:

var myArray = new Array();
var counter = 0;
function addElementToForm(value){
    counter ++;
    if (counter < 10)
    {
        $("#cheese").append(value + '<input type="number" value="0"><br />');
        myArray.push(counter + value);
    }
};

I have an ASP.NET form on the same page, in the same action of the sumbit button for the form, I want to be able to access myArray from the codefile as well!!

4
  • take a hidden control and store your array value in that and add runat="server" to your hidden control and access it from codebehind.Is that what you need? Commented Apr 16, 2012 at 10:18
  • how do i add the data to the hidden control, jst id.value = .... ; Commented Apr 16, 2012 at 10:36
  • yes,you can call as hiddencontrolid.value Commented Apr 16, 2012 at 10:37
  • cheers man, the best answer i've had from stack overflow so far!! Commented Apr 16, 2012 at 21:00

1 Answer 1

1

Take a hidden control and make it as runat="server" and try to keep the array value in the hidden control and access it from the codebehind file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.