How can I get a custom made set of checkboxes return values in the postback?
- by AngryHacker
I have the following in an aspx page:
<td colspan="2">
<% DisplayParties(); %>
</td>
In the code behind for the aspx page, i have this (e.g. I build HTML for the checkboxes):
public void DisplayParties() {
var s = new StringBuilder();
s.Append("<input type=\"checkbox\" id=\"attorney\" value=\"12345\"/>");
s.Append("<input type=\"checkbox\" id=\"attorney\" value=\"67890\"/>");
s.Append("<input type=\"checkbox\" id=\"adjuster\" value=\"125\"/>");
Response.WriteLine(s.ToString());
}
Not my proudest moment, but whatever. The problem is that when this page posts back via some event on the page, I never get these tags in the Request.Form collection.
Is this simply how ASP.NET works (e.g. only server-side control post back) or am I missing something simple.
My understanding was that a postback should bring back all the form variables.