Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Sending  several input tags with the same name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Seguros Catatumbo - 05 Sep 2007 00:52 GMT
Hi guys, i have a question. On old asp, if i did this:

<input type="text" name="myname" value="1">
<input type="text" name="myname" value="2">

asp would make request("myname")="1, 2"

on asp.net, request["myname"] is "1,2" (without the space)

The problem with this is that i am trying to pass multiple currency
values , which have commas inside them. On old asp this wasn't a
problem since i splitted the string with ", " but on asp.net i need to
do "," which of course wouldn't work properly.

Is there a way i can make asp.net use a different separator? Currently
i am employing a hack, replacing the commas with asterisks and then
change then back once read...
Peter Bromberg [C# MVP] - 05 Sep 2007 01:34 GMT
I don't know what the advantage of using multiple form elements all with the
same names might be, other than to force you to employ hacks to get around it.
However, the hack you describe seems to work, so "if it ain't broke, don't
fix it".
Peter
Recursion: see Recursion
site:  http://www.eggheadcafe.com
unBlog:  http://petesbloggerama.blogspot.com
BlogMetaFinder:    http://www.blogmetafinder.com

> Hi guys, i have a question. On old asp, if i did this:
>
[quoted text clipped - 13 lines]
> i am employing a hack, replacing the commas with asterisks and then
> change then back once read...
Seguros Catatumbo - 05 Sep 2007 02:17 GMT
> I don't know what the advantage of using multiple form elements all with the
> same names might be, other than to force you to employ hacks to get around it.
> However, the hack you describe seems to work, so "if it ain't broke, don't
> fix it".

The advantage is less code.
You can simply split the request variable to an array of strings and
work with them in a simple iteration. If i would use different names
for the variables, it would require more code. Storing objects in the
session or in the viewstate would not be as efficient.  Old asp's way
of handling same name input was better IMO
Mark Rae [MVP] - 05 Sep 2007 07:38 GMT
>> I don't know what the advantage of using multiple form elements all with
>> the
[quoted text clipped - 5 lines]
>
> The advantage is less code.

That's not necessarily better...

> You can simply split the request variable to an array of strings and
> work with them in a simple iteration. If i would use different names
> for the variables, it would require more code.

But less hacking...

> Old ASP's way of handling same name input was better IMO
> <input type="text" name="myname" value="1">
> <input type="text" name="myname" value="2">

Hmm - if you add a new text control between those two, you'd have to give it
a value of 3 - after a while, that would surely get really messy, no...?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.