R
Roshawn Dawson
Hi,
I'm having the hardest time trying to understand the proper usage of
forms in ASP.NET.
Alrightie then! I have a form on my ASP.NET page. To be more specific,
this page displays the items in one's shopping cart. Its layout is done
using a Repeater control. With the exception of the Repeater control
and a button, all other controls inside the form are not server controls
(none contain the runat="server" attribute). They are simple html input
elements created in code. Here's a sample of my code (to give you a
better understanding):
<form id="Form1" method="post" runat="server">
<asp:repeater id="Cart" runat="server"><headertemplate>
<table id="items" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th scope="col"><input type="checkbox"
onclick="javascript:checkAll(this);" id="allItms"/></th>
<th scope="col">Title</th>
<th scope="col">Price</th>
<th scope="col">Quantity</th>
<th scope="col">Total</th>
</tr></thead><tbody></headertemplate>
<itemtemplate>
<tr>
<td><input type="checkbox" id="itm"></td>
<td><a href="Details.aspx?isbn=<%# DataBinder.Eval(Container.DataItem,
"ISBN")%>"><%# DataBinder.Eval(Container.DataItem, "Title")%></a></td>
<td class="price"><%# DataBinder.Eval(Container.DataItem, "Price")%></td>
<td><input type="text" value="<%# DataBinder.Eval(Container.DataItem,
"Quantity")%>" id="Qty" /></td>
<td class="price"><%# DataBinder.Eval(Container.DataItem,
"ItemTotal")%></td>
</tr></itemtemplate>
<footertemplate></tbody>
<tfoot>
<tr><td id="subttl" colspan="5">Subtotal: <%# subtotal
%></td></tr></tfoot></table></footertemplate></asp:repeater>
<asp:button enableviewstate="False" runat="server" text="Update"
id="Update"></asp:button>
</form>
Ok. Now the seemingly "big" question: Can I access any of the form's
input elements via HttpRequest.Form (even though they are not server
controls)? If so, can this be done using a code-behind file?
Thanks,
Roshawn
I'm having the hardest time trying to understand the proper usage of
forms in ASP.NET.
Alrightie then! I have a form on my ASP.NET page. To be more specific,
this page displays the items in one's shopping cart. Its layout is done
using a Repeater control. With the exception of the Repeater control
and a button, all other controls inside the form are not server controls
(none contain the runat="server" attribute). They are simple html input
elements created in code. Here's a sample of my code (to give you a
better understanding):
<form id="Form1" method="post" runat="server">
<asp:repeater id="Cart" runat="server"><headertemplate>
<table id="items" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th scope="col"><input type="checkbox"
onclick="javascript:checkAll(this);" id="allItms"/></th>
<th scope="col">Title</th>
<th scope="col">Price</th>
<th scope="col">Quantity</th>
<th scope="col">Total</th>
</tr></thead><tbody></headertemplate>
<itemtemplate>
<tr>
<td><input type="checkbox" id="itm"></td>
<td><a href="Details.aspx?isbn=<%# DataBinder.Eval(Container.DataItem,
"ISBN")%>"><%# DataBinder.Eval(Container.DataItem, "Title")%></a></td>
<td class="price"><%# DataBinder.Eval(Container.DataItem, "Price")%></td>
<td><input type="text" value="<%# DataBinder.Eval(Container.DataItem,
"Quantity")%>" id="Qty" /></td>
<td class="price"><%# DataBinder.Eval(Container.DataItem,
"ItemTotal")%></td>
</tr></itemtemplate>
<footertemplate></tbody>
<tfoot>
<tr><td id="subttl" colspan="5">Subtotal: <%# subtotal
%></td></tr></tfoot></table></footertemplate></asp:repeater>
<asp:button enableviewstate="False" runat="server" text="Update"
id="Update"></asp:button>
</form>
Ok. Now the seemingly "big" question: Can I access any of the form's
input elements via HttpRequest.Form (even though they are not server
controls)? If so, can this be done using a code-behind file?
Thanks,
Roshawn