473,549 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I duplicate the form data?

I want to duplicate the form data, edit it to remove some items (such
as __EVENTTARGET, __EVENTVALIDATI ON, etc) and save it to a log.

How can I make a duplicate (editable) copy of the Form Collection?

The Form Collection is of type NameValueCollec tion is, underneath the
covers, an object of type HttpValueCollec tion.

The problem I have is that my copies have only one key item for a list
(such as a radio button list) whereas the Form has one key per item in
the collection (duplicate keys).

Apart from doing something like:

string aCopy = myForm.ToString ();

and then rebuilding the NameValueCollec tion how can I make an editable
duplicate with duplicate keys for lists?

myForm is passed into a method so:

public void TheHeader(NameV alueCollection myForm)
{
...

the calling code is:

SomeClass.TheHe ader(Request.Fo rm);

When this happens the resulting myForm is read only.

The code within TheHeader could be:

NameValueCollec tion nvc = new NameValueCollec tion();
foreach (string key in myForm)
nvc.Add(key, myForm[key]);

or below which duplicates the above (using the 1st contructor of the
Add method rather than 2nd):

NameValueCollec tion nvc = new NameValueCollec tion();
nvc.Add(Request .Form)

No matter how the Form is copied the copy isn't the same because the
original Form has a separate key for each item in a collection (such
as a radio button list). The copy (nvc) will contain only one key
followed by a comma separated value list.

If I serialise it to a string and then use split to put it into an
array how can I be sure that the viewstate and other asp.net fields
won't this up by using the special characters & = , used to delimit
the keys and data?
May 4 '07 #1
2 2530
Just get them all and ignore what you want when dumping to the log file ?

It could be just done in global.asax using the request.form collection (if I
understand what you are trying to do) so that it is easily
changed/removed/added as needed.

(My understanding is that you want just to keep track of posted values in a
server side log.)

"Harry Haller" <Ha***@Steppenw olf.coma écrit dans le message de news:
2c************* *************** ****@4ax.com...
>I want to duplicate the form data, edit it to remove some items (such
as __EVENTTARGET, __EVENTVALIDATI ON, etc) and save it to a log.

How can I make a duplicate (editable) copy of the Form Collection?

The Form Collection is of type NameValueCollec tion is, underneath the
covers, an object of type HttpValueCollec tion.

The problem I have is that my copies have only one key item for a list
(such as a radio button list) whereas the Form has one key per item in
the collection (duplicate keys).

Apart from doing something like:

string aCopy = myForm.ToString ();

and then rebuilding the NameValueCollec tion how can I make an editable
duplicate with duplicate keys for lists?

myForm is passed into a method so:

public void TheHeader(NameV alueCollection myForm)
{
...

the calling code is:

SomeClass.TheHe ader(Request.Fo rm);

When this happens the resulting myForm is read only.

The code within TheHeader could be:

NameValueCollec tion nvc = new NameValueCollec tion();
foreach (string key in myForm)
nvc.Add(key, myForm[key]);

or below which duplicates the above (using the 1st contructor of the
Add method rather than 2nd):

NameValueCollec tion nvc = new NameValueCollec tion();
nvc.Add(Request .Form)

No matter how the Form is copied the copy isn't the same because the
original Form has a separate key for each item in a collection (such
as a radio button list). The copy (nvc) will contain only one key
followed by a comma separated value list.

If I serialise it to a string and then use split to put it into an
array how can I be sure that the viewstate and other asp.net fields
won't this up by using the special characters & = , used to delimit
the keys and data?

May 4 '07 #2
The following doesn't work either:

NameValueCollec tion nvc = new NameValueCollec tion(myForm);

once again the resulting collection has only one key for a radio
button list values rather than a key per entry (as in the original
form).

May 4 '07 #3

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

Similar topics

1
14011
by: marx | last post by:
I have a bit of a problem and any help would be much appreciated. Problem: I have two dropdown list boxes with same data(all data driven). These are used for two separate entries. For every entry you cannot choose the same value twice. For example, I cannot choose for entry 1 the same value in both selection boxes (gqCategory1Entry1 and...
2
1920
by: Pablo | last post by:
Hello, there, I have a table tblData which has pharmacy data. The table has following fields: ClaimNum, LineNum... The ClaimNum has claim number which is 12 characters. LineNum is NULL. The table looks like this ClaimNum LineNum abcde1234561 abcde1234561
3
1847
by: Donna Price | last post by:
I have a problem with a database which I've recently separated into several related tables. I have a main data entry form, which has several subforms on it on tabbed pages. The first subform is actually part of the main data table, however, when I try to add new data to the form all is OK until I reach the first tab page which has specific...
8
3270
by: Mark | last post by:
When my form goes to a new record, I have a procedure that copies the last record added to the form's underlying table into the form. The intent is that a series of new records may have the same data in many of the fields so I paste in the same values of the previous record and then edit what needs edited in the new record saving much retyping...
0
2874
by: Suler Abou | last post by:
Hi, I'm having a problem with an SQL statement, I have a statement that goes like this: "INSERT INTO table VALUES('TransID','CID',etc...);" it basically adds new data to a table. When the form is posted it adds the data just fine. However, when you try to add more new data it adds the data and it duplicates it again with different...
8
20541
by: Ray | last post by:
I have a data input form and need to automatically duplicate the existing record as a new record by clicking a button. The main purpose to duplicate the record is that the new record is very similar to the existing record with minor differences. It will save the data input operator a lot of afford by editing the minor difference only. ...
6
6507
by: planetthoughtful | last post by:
Hi All, I have a C# ASP.NET page that submits back to itself to insert details from a form into a database table. When / if the user refreshes the page (and gets the standard warning that POST data will be resubmitted), the previously submitted record is sumbitted again, and a duplicate record is inserted into the table. In PHP I would...
6
11873
by: Oleg Konovalov | last post by:
Hi, I have a Java/JavaScript GUI application where I perform a lot of long DB operations , which takes 5-60 secs to perform. Sometimes user double-clicks the button or just gets impatient and clicks again, which created duplicate forcm submission and hence duplicate records. So I am trying to disable the button as soon as it is clicked,...
2
1856
by: fabiola1 | last post by:
I'm using Ms Access 2003. I have five tables called tblAllContract tblType tbInteranlContact tblSupplier tblManager The other four tables are linked to tblAllContracts with Id's.I have a bound form called frmViewContracts where i view all my contracts on the system.This form is from query called qryViewContracts.
0
7541
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...
0
7464
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...
0
7734
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. ...
0
7979
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...
0
6065
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...
1
5385
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5107
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
781
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...

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.