Reputation: 31
Here the textbox with id as "a" retains the value after postbacks while textbox with id as "b" not retains the value.Why this happens?
<form id="form1" runat="server">
<div>
<asp:TextBox ID="a" runat="server" AutoPostBack="true" ></asp:TextBox>
<form action="javascript:myFunc();">
<p>
<input type="text" id="city-field" name="city" " />
<input type="submit" value="Find" /></p>
</form>
</div>
<asp:TextBox ID="b" runat="server" AutoPostBack="true" ></asp:TextBox>
</form>
Upvotes: 0
Views: 478
Reputation: 887837
HTML does not support nested <form>
tags.
The browser drops the inner <form>
, then uses the inner </form>
to close the outer <form>
.
Therefore, the second textbox never gets posted back.
You can see this in Firebug.
Upvotes: 3