Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Forms collection in ASP.NET

Reply
Thread Tools

Forms collection in ASP.NET

 
 
Roshawn Dawson
Guest
Posts: n/a
 
      09-21-2005
Hi,

This may seem like a trivial question, but I haven't been able to get this to work. Here goes...

I have an .aspx page that is rendered using an xml file and an xsl file. The xsl file renders an
html form and a number of controls on the page, in addition to transforming the xml file. (It goes
without saying that neither the html form nor the other controls are server controls.) Everything is
rendered as I desire.

But using the form in code behind is my problem. When I try to access the form using the Request
object, I get nothing. The form and all of the controls that it contains have their needed
attributes set (name, id, value, etc.). I, however, can't access any of the form's controls using
the Request.Forms collection.

Considering the fact that I'm using an xsl file to render the html to the page, is this the reason
that I can't access the controls in the form's collection? Must I create the html without the xsl
file in order to get this to work?

Thanks,
Roshawn
 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      09-21-2005
Are you just using the "good ole" Request.Form["inputname"] method to get
your values? If so, do your inputs have NAMES in the html? (Do a
view-source.) Also, you're using method=POST in your form, not method=GET,
right?

Ray at home

"Roshawn Dawson" <> wrote in message
news:enCZ$...
> Hi,
>
> This may seem like a trivial question, but I haven't been able to get this
> to work. Here goes...
>
> I have an .aspx page that is rendered using an xml file and an xsl file.
> The xsl file renders an html form and a number of controls on the page, in
> addition to transforming the xml file. (It goes without saying that
> neither the html form nor the other controls are server controls.)
> Everything is rendered as I desire.
>
> But using the form in code behind is my problem. When I try to access the
> form using the Request object, I get nothing. The form and all of the
> controls that it contains have their needed attributes set (name, id,
> value, etc.). I, however, can't access any of the form's controls using
> the Request.Forms collection.
>
> Considering the fact that I'm using an xsl file to render the html to the
> page, is this the reason that I can't access the controls in the form's
> collection? Must I create the html without the xsl file in order to get
> this to work?
>
> Thanks,
> Roshawn



 
Reply With Quote
 
 
 
 
John Mardera
Guest
Posts: n/a
 
      09-21-2005

Post a sample html so we can see what can be wrong with it.


"Roshawn Dawson" <> wrote in message
news:enCZ$...
> Hi,
>
> This may seem like a trivial question, but I haven't been able to get this
> to work. Here goes...
>
> I have an .aspx page that is rendered using an xml file and an xsl file.
> The xsl file renders an html form and a number of controls on the page, in
> addition to transforming the xml file. (It goes without saying that
> neither the html form nor the other controls are server controls.)
> Everything is rendered as I desire.
>
> But using the form in code behind is my problem. When I try to access the
> form using the Request object, I get nothing. The form and all of the
> controls that it contains have their needed attributes set (name, id,
> value, etc.). I, however, can't access any of the form's controls using
> the Request.Forms collection.
>
> Considering the fact that I'm using an xsl file to render the html to the
> page, is this the reason that I can't access the controls in the form's
> collection? Must I create the html without the xsl file in order to get
> this to work?
>
> Thanks,
> Roshawn



 
Reply With Quote
 
Roshawn Dawson
Guest
Posts: n/a
 
      09-21-2005
Hi guys, thanks for your response.

To answer Ray Costanzo's questions:

1. I'm not using the "good ole" Request.Form(inputname) method to get my values. Instead I'm
using the various properties of the Form collection (GetValues, GetKey, and Get).
2. All input elements have names. However, the names are dynamic. They're based on some data that
is contained within the xml file that's being transformed. Even the form itself has a name.
Does it help to mention that the form contains a table that houses the the input elements in its
rows? (To be specific, there is a checkbox that is used to check all other checkboxes in the
form)
3. Yes, the form's method is POST


To John Mardera:

Here's sample html for the form. As I mentioned above, the form contains a table that has input
elements in its rows:

<form id="Cart" method="post" action="ShoppingCart.aspx">
<table id="items" cellpadding="0" cellspacing="0">
<caption>Your Shopping Cart</caption>
<thead>
<tr>
<th scope="col"><input type="checkbox" id="allItms" onclick="javascript:checkAll2(this)" /></th>
<th scope="col">Title</th>
<th scope="col">Price</th>
<th scope="col">Quantity</th>
<th scope="col">Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox" name="U175XG760VMHCS" /></td>
<td><a href="Details.aspx?asin=159200878X">Maran Illustrated Mac OS X v.10.4 Tiger</a></td>
<td class="price">$14.99</td>
<td><input type="text" name="U175XG760VMHCS" maxlength="3" value="1" /></td>
<td class="price">$14.99</td>
</tr>
<tr>
<td><input type="checkbox" name="U1YOOYBVTVBOX6" /></td>
<td><a href="Details.aspx?asin=0071436820">Investing in Rental Properties</a></td>
<td class="price">$11.61</td>
<td><input type="text" name="U1YOOYBVTVBOX6" maxlength="3" value="1" /></td>
<td class="price">$11.61</td>
</tr>
<tr>
<td><input type="checkbox" name="UGNFCT3Q1NT2M" /></td>
<td><a href="Details.aspx?asin=0060765313">YOU: The Owner's Manual</a></td>
<td class="price">$15.99</td>
<td><input type="text" name="UGNFCT3Q1NT2M" maxlength="3" value="1" /></td>
<td class="price">$15.99</td>
</tr>
</tbody>
<tfoot>
<tr>
<td id="subttl" colspan="5">Subtotal: $42.59</td>
</tr>
</tfoot>
</table>
<input type="submit" value="Update" />
</form>

HTH,
Roshawn
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
create collection of collection Hemant ASP .Net 1 10-22-2009 03:04 PM
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Øyvind Isaksen ASP .Net 1 05-18-2007 09:24 AM
Sorting the Collection(java.util.Collection) of Elements Pradeep Java 2 01-24-2007 02:33 PM
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
STL - an algorithm for finding a collection within a collection? Dylan C++ 5 03-22-2005 01:31 AM



Advertisments