473,778 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HowTo: get request.form[i].name

Hello,

HowTo: catch name/value pairs from request.form?

My viewstate shows:
"__VIEWSTATE=.. &111=5.."
I want to get this pairs of IDs/names [111] and values [5].
But because the DropDownList ist dynamically created I don't know the
name/ID of the created list. I can parse the viewState string to get the
related name/value pairs, but I think there will be a more simple way
provided by the request-object??

wkr: Wilhelm Pieper
Nov 17 '05 #1
5 8846
Hi,

I don’t know how you get the data from __viewstate field. This data is
handling by the LosFormatter class. This class serializes the values of
the controls into string presentation. The data format in the
__viewstate isn’t in key=value format.

Anyway you can get data from the Form Collection:
string x = Request.form["myTextCont rol"];

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #2

"Natty Gur" <na***@dao2com. com> schrieb im Newsbeitrag
news:eh******** ******@tk2msftn gp13.phx.gbl...

I don't know how you get the data from __viewstate field. .. Debugger :-)
Anyway you can get data from the Form Collection:
string x = Request.form["myTextCont rol"];

But I don't know the name "myTextControl" .
When getting the request.forms string I loop through this string and get
the values I'm looking for but not the names related to this items:
for (int i=0;i<Request.F orm.Count;i++)

Double dTmp = Convert.ToDoubl e(Request.Form[i].ToString());
if (dTmp > 0) ..

Nov 17 '05 #3
OK,

1)using debugger nice :-).

2)What you really after? viewstate will return the last state of the
control on the server while Form collection holds the values that sends
from the client.

Any way if you want you can:
1) Use the LosFormatter class to get the cached data from the
__viewstate field.
2) Loop through the form elements (as you already did) to get the data
Send from the client
3) Loop through the WebForm controls to get their current values (the
cached data and the one that changed by the user).

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #4
Hello Natty,

thanks to your reply.
Because your solution looks a little bit more code I tried
string[] strRequest = Request.Form.To String().Split( '&');

This returns all pairs I'm interested in in an easy to parse array like:
"112=5", "113=4" and so on.
"Natty Gur" <na***@dao2com. com> schrieb im Newsbeitrag
news:#e******** ******@TK2MSFTN GP10.phx.gbl...
...
1) Use the LosFormatter class to get the cached data from the
__viewstate field. Isn't this the same like Request.Form.To String()??
2) Loop through the form elements (as you already did) to get the data
Send from the client
3) Loop through the WebForm controls to get their current values (the
cached data and the one that changed by the user).

I could (probably) do, but I'm not shure with this because my controls are
added on the fly.
So they may be not part of the controls collection.

wkr: Wilhelm Pieper
Nov 17 '05 #5
I think you have a fundimental misunderstandin g of .Net

you DON"T need access to viewstate. The value of your control is
automatically restored in your application on post-back. You query it's
value then.

These three properties should give you what you want

"DropDownContro l.SelectedValue "
"DropDownContro l.SelectedIndex "
"DropDownContro l.SelectedItem"

..Net removes you from dealing with the behind the scene plumbing of the
web - GONE are the days of splitting on "&" etc etc etc.
(unless you are a PHP pup (doh!))
"Wilhelm Pieper" <w_******@web.d e> wrote in message
news:ez******** ******@TK2MSFTN GP12.phx.gbl...
Hello,

HowTo: catch name/value pairs from request.form?

My viewstate shows:
"__VIEWSTATE=.. &111=5.."
I want to get this pairs of IDs/names [111] and values [5].
But because the DropDownList ist dynamically created I don't know the
name/ID of the created list. I can parse the viewState string to get the
related name/value pairs, but I think there will be a more simple way
provided by the request-object??

wkr: Wilhelm Pieper

Nov 17 '05 #6

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

Similar topics

3
6189
by: Roberto | last post by:
I have the following problem: I have the following form client side: <FORM.......> <FORM action="./WZUpload.asp" method="Post" enctype="multipart/form-data" WIDTH=100%> <INPUT Type="file" name="UpFileName" STYLE="{Width:400px}"><BR>
5
2200
by: Jack | last post by:
Hi, I am trying to get a thorough understanding of a code where a addition or deletion of records can be done from a list of records. For addition part of the form, data is being obtained from set of input boxes. The following is the code being used: If Len(Request.Form("ID_0"))>0 Then AuthorID=Request.Form("ID_0") FName=Request.Form("fName_0") LName=Request.Form("lName_0")
4
1498
by: John Marble | last post by:
My system is near finished, it is something quite basic where the users interfer with the data via forms. I want to limit my groups in what they can SEE from the database. Like, I want my average users (groupe name: USERS) to only be able to see one form, from where they will be provided with everything they need for work, they won't see the macros, the table etc.. I also have a second group (group name: RESP) that only need to see...
8
4195
by: Topper | last post by:
Hello. I have simple web folders structure: -ROOT - BIN WebService.dll WebService.asmx I need to use my WebService.dll not in bin folder - for example, in ROOT. How do i this? How can i do this without .config file only with some configuration
14
19947
by: Drew | last post by:
I need to iterate through a submitted form, inserting data on each pass. In the past, I have always used form elements that were named with numbers at the end, like this, name1 relationship1 name2 relationship2 name3 relationship3 With the above formatting, I could write a For... Next loop to insert all the data into my database,
4
4850
by: whyyyy | last post by:
USING IIS 5.1, and Windows XP pro, the following form works on my system, and I can use as many form elements as I wish, as long as all form elements have the same name: "words", in this example. Help -- why can`t I give each form element a different name? Any suggestions will be gratefully appreciated. Also,See example at very bottom of something that once worked on a remote server, but doesn't on IIS 5.1, windows xp pro
7
9662
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Make CStr for JavaScript on ASP w/ Request.Form and QueryString In ASP, Request.Form and Request.QueryString return objects that do not support "toString", or any JavaScript string operation on parameters not passed. Example: Make a TST.asp and post to it as TST.asp?STATE=TEST <%@ Language=JavaScript %> <%
6
10569
by: fnoppie | last post by:
Hi, I am near to desperation as I have a million things to get a solution for my problem. I have to post a multipart message to a url that consists of a xml file and an binary file (pdf). Seperately the posting words fine but when I want to create one multipart message with both then things go wrong. The binary file is converted and of datatype byte() The xml file is just a string.
2
6308
by: MDANH2002 | last post by:
Hi From VB.NET I want to simulate the POST request of the following HTML form <html> <title>HTTP Post Testing</title> <body> <form action=http://www.example.com/postdata enctype="multipart/form-data" method="post" name="testform">
0
10296
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
10127
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
9923
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
8954
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...
1
7474
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5370
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...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
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

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.