|
[x]
Posted via EE Mobile
|
|
| Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
|
|
|
|
Asked by aspnewbie09 in Programming for ASP.NET, JavaScript Frameworks
Need help with this code(page 1 - .aspx):
i found another javascript that will create the textbox; but it is postback to the same page. how do i get to post it to another page without losing its value. i think an array to store the value would be a good option; but didn't know where to begin.
thanks
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
|
.aspx code
<head runat="server">
<title></title>
<script type="text/javascript">
function addInput()
{
var div2 = document.getElementById("div2");
var input = document.createElement('input');
input.setAttribute("type", "text");
var counter = div2.childNodes.length + 1;
input.setAttribute("name","myInput"+counter);
div2.appendChild(input);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="text" name="myInput0" />
<input type="button" value="MoreTextBox" onclick="addInput();" />
<div id="div2" style="width:100px">
</div>
<asp:Button ID="Button1" runat="server" Text="Submit" />
<br />
<br />
<br />
<asp:Label ID="NewResult" runat="server"></asp:Label>
</div>
</form>
.aspx.vb code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim postData As New List(Of String)()
//Dim myArray As New ArrayList()
For i As Integer = 0 To Request.Form.AllKeys.Length - 1
If Request.Form.AllKeys(i).Contains("myInput") Then
Dim value As String = Request.Form.[Get](i)
postData.Add(value)
End If
Next
For Each value As String In postData
Response.Write(value + "<br />")
Next
End Sub
|
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625