Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:40 PM
James Baker
Guest
 
Posts: n/a
Default Request.Form & Arrays

I'm trying to use Request.Form to gather information in an array and I keep
getting a type mismatch...not sure if it's even possible. Basically, Page 1
posts to Page 2...and Page 1 contains a variable declared as:

Dim mLic(50)

....which is then populated. When I try:

Request.Form("mLic()") or
Request.Form("mLic") or
Request.Form("mLic(50)")

I get a type mismatch every time. Is there a better/right way to do this?

Thanks!
James


  #2  
Old July 19th, 2005, 01:40 PM
Aaron [SQL Server MVP]
Guest
 
Posts: n/a
Default Re: Request.Form & Arrays

How are you sending an "array" via post? Get and Post handle strings
only... you't can pass an array like this and retrieve it via the request
collection.

--
http://www.aspfaq.com/
(Reverse address to reply.)




"James Baker" <cppjames@hotmail.com> wrote in message
news:ezz2xwJTEHA.544@TK2MSFTNGP11.phx.gbl...[color=blue]
> I'm trying to use Request.Form to gather information in an array and I[/color]
keep[color=blue]
> getting a type mismatch...not sure if it's even possible. Basically, Page[/color]
1[color=blue]
> posts to Page 2...and Page 1 contains a variable declared as:
>
> Dim mLic(50)
>
> ...which is then populated. When I try:
>
> Request.Form("mLic()") or
> Request.Form("mLic") or
> Request.Form("mLic(50)")
>
> I get a type mismatch every time. Is there a better/right way to do this?
>
> Thanks!
> James
>
>[/color]


  #3  
Old July 19th, 2005, 01:40 PM
James Baker
Guest
 
Posts: n/a
Default Re: Request.Form & Arrays

Fair enough...(forgive me, I'm trying to learn ASP again). Can a Session
variable handle this? What's the ideal method for "sharing" an array
between pages?

James


"Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:eStLlzJTEHA.1468@TK2MSFTNGP09.phx.gbl...[color=blue]
> How are you sending an "array" via post? Get and Post handle strings
> only... you't can pass an array like this and retrieve it via the request
> collection.
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
>
>
> "James Baker" <cppjames@hotmail.com> wrote in message
> news:ezz2xwJTEHA.544@TK2MSFTNGP11.phx.gbl...[color=green]
> > I'm trying to use Request.Form to gather information in an array and I[/color]
> keep[color=green]
> > getting a type mismatch...not sure if it's even possible. Basically,[/color][/color]
Page[color=blue]
> 1[color=green]
> > posts to Page 2...and Page 1 contains a variable declared as:
> >
> > Dim mLic(50)
> >
> > ...which is then populated. When I try:
> >
> > Request.Form("mLic()") or
> > Request.Form("mLic") or
> > Request.Form("mLic(50)")
> >
> > I get a type mismatch every time. Is there a better/right way to do[/color][/color]
this?[color=blue][color=green]
> >
> > Thanks!
> > James
> >
> >[/color]
>
>[/color]


  #4  
Old July 19th, 2005, 01:40 PM
Aaron [SQL Server MVP]
Guest
 
Posts: n/a
Default Re: Request.Form & Arrays

Page 1:

dim myArray(1)
myArray(0) = "a"
myArray(1) = "b"
session("myArray") = myArray

Page 2:

myArray = session("myArray")
response.write myArray(0)

However, unless this is a complex array, you are likely better off to avoid
session variable and pass a comma-delimited string around. IMHO.

--
http://www.aspfaq.com/
(Reverse address to reply.)




"James Baker" <cppjames@hotmail.com> wrote in message
news:uSdX52JTEHA.3768@TK2MSFTNGP11.phx.gbl...[color=blue]
> Fair enough...(forgive me, I'm trying to learn ASP again). Can a Session
> variable handle this? What's the ideal method for "sharing" an array
> between pages?
>
> James
>
>
> "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
> news:eStLlzJTEHA.1468@TK2MSFTNGP09.phx.gbl...[color=green]
> > How are you sending an "array" via post? Get and Post handle strings
> > only... you't can pass an array like this and retrieve it via the[/color][/color]
request[color=blue][color=green]
> > collection.
> >
> > --
> > http://www.aspfaq.com/
> > (Reverse address to reply.)
> >
> >
> >
> >
> > "James Baker" <cppjames@hotmail.com> wrote in message
> > news:ezz2xwJTEHA.544@TK2MSFTNGP11.phx.gbl...[color=darkred]
> > > I'm trying to use Request.Form to gather information in an array and I[/color]
> > keep[color=darkred]
> > > getting a type mismatch...not sure if it's even possible. Basically,[/color][/color]
> Page[color=green]
> > 1[color=darkred]
> > > posts to Page 2...and Page 1 contains a variable declared as:
> > >
> > > Dim mLic(50)
> > >
> > > ...which is then populated. When I try:
> > >
> > > Request.Form("mLic()") or
> > > Request.Form("mLic") or
> > > Request.Form("mLic(50)")
> > >
> > > I get a type mismatch every time. Is there a better/right way to do[/color][/color]
> this?[color=green][color=darkred]
> > >
> > > Thanks!
> > > James
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


  #5  
Old July 19th, 2005, 01:40 PM
Bob Barrows [MVP]
Guest
 
Posts: n/a
Default Re: Request.Form & Arrays

James Baker wrote:[color=blue]
> I'm trying to use Request.Form to gather information in an array and
> I keep getting a type mismatch...not sure if it's even possible.
> Basically, Page 1 posts to Page 2...and Page 1 contains a variable
> declared as:
>
> Dim mLic(50)
>
> ...which is then populated.[/color]

Does this occur in client-side or server-side code?

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


  #6  
Old July 19th, 2005, 01:40 PM
James Baker
Guest
 
Posts: n/a
Default Re: Request.Form & Arrays

Server side...I realized the error of my ways when trying to "POST" the
array. Now I'm searching for a better approach.


  #7  
Old July 19th, 2005, 01:40 PM
James Baker
Guest
 
Posts: n/a
Default Re: Request.Form & Arrays

Well, I'm toying with the idea of just written out hidden tags/values and
using request.form that way, as opposed to the array. In order to pass a
comma delimited string, I'd have to parse/concatenate the entire array,
right? I'm trying to see the benefit I guess.


"Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
news:uNSxA8JTEHA.3548@TK2MSFTNGP09.phx.gbl...[color=blue]
> Page 1:
>
> dim myArray(1)
> myArray(0) = "a"
> myArray(1) = "b"
> session("myArray") = myArray
>
> Page 2:
>
> myArray = session("myArray")
> response.write myArray(0)
>
> However, unless this is a complex array, you are likely better off to[/color]
avoid[color=blue]
> session variable and pass a comma-delimited string around. IMHO.
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
>
>
> "James Baker" <cppjames@hotmail.com> wrote in message
> news:uSdX52JTEHA.3768@TK2MSFTNGP11.phx.gbl...[color=green]
> > Fair enough...(forgive me, I'm trying to learn ASP again). Can a[/color][/color]
Session[color=blue][color=green]
> > variable handle this? What's the ideal method for "sharing" an array
> > between pages?
> >
> > James
> >
> >
> > "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
> > news:eStLlzJTEHA.1468@TK2MSFTNGP09.phx.gbl...[color=darkred]
> > > How are you sending an "array" via post? Get and Post handle strings
> > > only... you't can pass an array like this and retrieve it via the[/color][/color]
> request[color=green][color=darkred]
> > > collection.
> > >
> > > --
> > > http://www.aspfaq.com/
> > > (Reverse address to reply.)
> > >
> > >
> > >
> > >
> > > "James Baker" <cppjames@hotmail.com> wrote in message
> > > news:ezz2xwJTEHA.544@TK2MSFTNGP11.phx.gbl...
> > > > I'm trying to use Request.Form to gather information in an array and[/color][/color][/color]
I[color=blue][color=green][color=darkred]
> > > keep
> > > > getting a type mismatch...not sure if it's even possible.[/color][/color][/color]
Basically,[color=blue][color=green]
> > Page[color=darkred]
> > > 1
> > > > posts to Page 2...and Page 1 contains a variable declared as:
> > > >
> > > > Dim mLic(50)
> > > >
> > > > ...which is then populated. When I try:
> > > >
> > > > Request.Form("mLic()") or
> > > > Request.Form("mLic") or
> > > > Request.Form("mLic(50)")
> > > >
> > > > I get a type mismatch every time. Is there a better/right way to do[/color]
> > this?[color=darkred]
> > > >
> > > > Thanks!
> > > > James
> > > >
> > > >
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]


  #8  
Old July 19th, 2005, 01:40 PM
Bob Barrows [MVP]
Guest
 
Posts: n/a
Default Re: Request.Form & Arrays

James Baker wrote:[color=blue]
> Well, I'm toying with the idea of just written out hidden tags/values
> and using request.form that way, as opposed to the array. In order
> to pass a comma delimited string, I'd have to parse/concatenate the
> entire array, right? I'm trying to see the benefit I guess.
>[/color]

No. You can use the Join function to return a delimited string from an
array. You can then response.write the string into a hidden form element.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


  #9  
Old July 19th, 2005, 01:40 PM
James Baker
Guest
 
Posts: n/a
Default Re: Request.Form & Arrays

Thanks for your help...I think I'm good to go now. With every passing
moment, I appreciate ASP.NET that much more.


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles