473,661 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.....whic h 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.Collect ions.Specialize d.NameValueColl ection'. If I pass it a
NameValueCollec tion'...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 1242
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.H tmlControls.Htm lForm theForm;
protected System.Web.UI.H tmlControls.Htm lInputText 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.u k.com> wrote in message
news:uq******** ******@TK2MSFTN GP09.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.....whic h 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.Collect ions.Specialize d.NameValueColl ection'. If I pass it a
NameValueCollec tion'...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
1633
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 creating a datetime value in my asp pages that I am putting in a session. Now this isn't being passed from page to page while other session objects are. There is no reason I can see for this happening. The steps I am using are: page1.asp - A...
3
1505
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 from the previous page. One way that I could think of would be to have the submit button's event handler call response.redirect with a querystring attached on based on values that I could attach on. First question: Could I do the same thing but...
2
2685
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 : Anonymous Login Anonymous login is set to use a domain user to enable a sql server authenticated connection. Permissions are based on Page/action/user Membership
2
4615
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
10831
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 which has to parameters passed to it from another Web page Parameter # 1 dbid and Parameter # 2 reportid. I know that I can access the values of the parameters from the code behind .aspx.cs using Request.QueryString so
8
4407
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 click a button to determine whether the zip code is unique. If the zip code is not unique, another form/dialog is displayed (fclsLookup) - lookup form/dialog. The zip code is passed to the lookup form/dialog by reference. I then load a...
5
10496
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. Thanks!
5
3203
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 form values to pass to a confirmation page that shows the values entered and selected, with a CDONTS auto email generated at the same time. My problem is that I'm having trouble passing the values from the form to both the confirmation page and the...
23
3585
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 = errorInput & "Invalid return URL path! <BR>" errorExist = True Response.Redirect("InvalidUrlError.aspx")
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8855
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8758
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7364
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.