473,324 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Forms collection in ASP.NET

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
Nov 19 '05 #1
3 1156
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" <ud****@bellsouth.net> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
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

Nov 19 '05 #2

Post a sample html so we can see what can be wrong with it.
"Roshawn Dawson" <ud****@bellsouth.net> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
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

Nov 19 '05 #3
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
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark Hannon | last post by:
I am designing a PayPal shopping cart/store for a client and have placed several of PayPal's shopping cart forms on the page to correspond with different products. Each form has a unique name...
4
by: Soryt | last post by:
Hi everyone ! 1) An example from help: "Each Form object has a Controls collection, which contains all controls on the form. You can refer to a control on a form either by implicitly or...
4
by: sparks | last post by:
OK we have it so we can use tables to define skip patterns on our forms. BUT we can only do one form. Public Function skipPattern(currentFrm As Form, Optional currentCtl As Control = Null) As...
6
by: Edwinah63 | last post by:
Hi everyone, could someone give me some thoughts on the best way to manage mdi parent and child forms? in vb6 i could scroll through the forms collection and determine which forms were...
5
by: Simon Verona | last post by:
I have an application with a menu system which creates a new thread when a menu item is selected - some of these other threads may open a form for user interaction. Before the menu system is...
15
by: Alex | last post by:
Does anybody know why VB.NET would omit the Forms collection available in previous versions versions of VB? I imagine that there must be a reason why they decided to do away with it, but I can't...
12
by: Peter Van Wilrijk | last post by:
Hi, In VB6 I have the following code ... Dim frmLink As Form Set frmLink = Forms.Add(stringformname) frmLink.Show 'wait until all data has been loaded Do Until frmLink.Loaded = 21 DoEvent
2
by: Yuk Tang | last post by:
I have created my own custom forms called baseform, inheriting normal form properties and such. Baseform is, as can be expected, the basis for the other forms in my project. I want to close all...
18
by: Jerry Boone | last post by:
I'm looking for a way to fire a public sub/function when a form is opened and closed - without using form level events. I have already done some extensive form work with instancing, looping...
21
by: MLH | last post by:
Am having trouble with the following snippet. It stops after only cycling thru open forms. There are many more than that. How to modify this to cycle thru all forms? Sub AllOpenForms() Dim...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.