User876561910 posted
Hi
Lets say I have two pages (.aspx) with forms.
I post data from Page1 to Page2
On Page2 there is a dropdown with Autopostback = True.
When I select an option in this dropdown it clears the data sent from Page1.
How can I prevent this?
Thanks
PS – I have tried many, many possible ways from different forums online but none of them seem to work in my case.
e.g.
EnableViewState=false
Enabled=false
ReadOnly=true
etc.
Also I can't use an UpdatePanel on this site due to the server settings
eg. Page 1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Page1</title>
</head>
<body>
<form id="MyForm" runat="server">
<asp:TextBox runat="server" id="MyTextBox"></asp:TextBox>
<br />
<br/>
<asp:Button id="MyButton" postbackurl="page2.aspx" runat="server" Text="Button" />
</form>
</body>
</html>
and Page2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Page2</title>
<script runat="server" language="VB" type="text/vb">
Dim strText
Sub Page_Load()
strText = Request.Form("MyTextBox")
OtherTextBox.Text = strText
End Sub
</script>
</head>
<body>
<form id="MyNewform" runat="server">
<asp:TextBox runat="server" id="OtherTextBox"></asp:TextBox>
<br />
<br/>
<asp:DropDownList runat="server" AutoPostBack="true" id="MyDropDownList">
<asp:listitem>Item 1</asp:listitem>
<asp:listitem>Item 2</asp:listitem>
<asp:listitem>Item 3</asp:listitem>
</asp:DropDownList>
</form>
</body>
</html>