473,326 Members | 2,061 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,326 software developers and data experts.

Passing request.form contents to a class

Stu
Hi,

I have a class that is going to format all the fileds in a form post and
send them in an html email.

How do I pass the Request.Form contenst to a class? I know I can get the raw
data by converting it to a string, but this would mean processing the
string.....which is messy!

This is what I have got so far:

Private m_FormCol As Collection
Public WriteOnly Property formCol() As String
Set(ByVal Value As Collection)
m_FormCol = Value
End Set
End Property

I get the error Specified cast is not valid can't convert VB collection into
'System.Collections.Specialized.NameValueCollectio n'. If I pass it a
NameValueCollection'...how do I iterate through the items?

Thanks in Advance,

Stu

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003
Nov 17 '05 #1
1 1230
Any of your controls that have runat=server specified you just need to
declare in your base class, and you will be able to access them. So, if you
have:

<form runat="server" id="theForm">
<input type="text" runat="server" id="text">
</form>

Your code behind can have:

protected System.Web.UI.HtmlControls.HtmlForm theForm;
protected System.Web.UI.HtmlControls.HtmlInputText text;

With this declared at the class scope, you can then either iterate through
the child controls of the form or else directly fetch the items one by one
based on your explicit declaration, depending on what your needs are.

You have to think a bit differently with ASP.NET...

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
"Stu" <st****@ntpcl.uk.com> wrote in message
news:uq**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a class that is going to format all the fileds in a form post and
send them in an html email.

How do I pass the Request.Form contenst to a class? I know I can get the raw data by converting it to a string, but this would mean processing the
string.....which is messy!

This is what I have got so far:

Private m_FormCol As Collection
Public WriteOnly Property formCol() As String
Set(ByVal Value As Collection)
m_FormCol = Value
End Set
End Property

I get the error Specified cast is not valid can't convert VB collection into 'System.Collections.Specialized.NameValueCollectio n'. If I pass it a
NameValueCollection'...how do I iterate through the items?

Thanks in Advance,

Stu

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.507 / Virus Database: 304 - Release Date: 04/08/2003

Nov 17 '05 #2

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

Similar topics

4
by: bateman | last post by:
Hi, I have a rather puzzling problem, have asked the ASP experts at work with no joy and its driving me mad! I'll explain the steps in more detail below but the general problem is I am manually...
3
by: Ben R. | last post by:
I've got an asp.net application with a page that collects user info via forms and I'd like to have those values then passed to a 2nd page for a continuation which makes use of the entered values...
2
by: Laurent Bertin | last post by:
Hi i got a strange problem but it's true i don't make thing like anyone... First Config: + IIS5.0 SP2 (yes i know...) WebSite Security Root : Digest Authentication, NT Authenticated SubFolders...
2
by: Fabrizio | last post by:
HI, i need to pass a value from a Web Page to another in ASP.NET, eg. i want to keep the user name from a login page and diplay to next page . What should I use? Thanks, fabrizio
3
by: Joe Bloggs | last post by:
Does anyone know if its possible to pass parameters or the values of Request.QueryString from a web page to a custom control class? I'm using a C# Web Application. For Example I have Web Page1...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
5
by: GeRmIc | last post by:
Hi, I have an ASPX application from which I need to pass session variables (ex:username and password) to an ASP Page. How do I do this? Could you pls give a n example code for both aspx and asp....
5
by: jmartmem | last post by:
Greetings, I have built an Update Record Form in an ASP page. This form contains a number of fields, such as text boxes and menus, to name a few. Upon clicking the 'submit' button, I want the...
23
by: ryna | last post by:
Desperately need help.... here's the snippet of my code that im trying to solve since last week... icePayment.aspx If (Left(Request.Form("return_url"), 7) <> "http://") Then errorInput =...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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

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.