.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 13th, 2002, 02:20 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 23
Querystring -> Codebehind?

<i><b>Originally posted by : Bret (bret.vanhorn@tripleteam.com)</b></i><br />Okay, this is probably a silly question, but I'm new to .NET/VB and haven't been able to find an answer to this anywhere. <br /><br />I want to send a variable from an ASPX page querystring/GET form submission and have the codebehind for that page access that variable on postback, preferably without a server control. <br /><br />Classic ASP has that handy request.querystring("foo") method of accessing such variables, but I can't see a way to access that from the codebehind, even if I update the syntax to request.querystring("foo")(0).<br /><br />If anyone has any ideas, I'd gladly give you millions of dollars to ease my suffering mind -- only I don't have a million dollars. So my undying gratitude will have to suffice.<br /><br />Thanks in advance,<br /><br />-Bret<br /><br />

Reply With Quote
  #2  
Old May 20th, 2002, 12:42 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 23
<i><b>Originally posted by : Julia Lerman (jlerman@thedatafarm.com)</b></i><br />Bret-<br />I struggled with this one for a while a few weeks ago! The secret is that you have to shove the query string into a special type of collection and then pull out its elements. You can use this code to then go examine the SDK for more information.<br /><br />This code is in VB.Net.<br /><br />I am grabbing the elements and putting them into pre-defined variables and textboxes.<br /><br />Here is sample code of how I accomplished it:<br />The "Request" in my first line refers to the calling form.<br /><br /> Dim oRequest As HttpRequest = Request<br /> Dim arr2 As String<br /> Dim coll As Specialized.NameValueCollection<br /> coll = Request.QueryString<br /> If coll.Count > 1 Then '1 is the submit button<br /> arr2 = CStr(coll.GetValues("id")(0))<br /> If arr2 <> vbNullString Then<br /> m_iBooksid = CStr(coll.GetValues("id")(0))<br /> txtBookTitle.Value = CStr(coll.GetValues("booktitle")(0))<br /> txtAuthor.Value = CStr(coll.GetValues("author")(0))<br /> txtPublisher.Value = CStr(coll.GetValues("pub")(0))<br /> End If<br /> End If<br /><br />Julia Lerman<br />VTdotNet User Group Coordinator<br />www.thedatafarm.com/vtdotnet<br /><br /><br />------------<br />Bret at 5/13/2002 11:20:42 AM<br /><br />Okay, this is probably a silly question, but I'm new to .NET/VB and haven't been able to find an answer to this anywhere. <br /><br />I want to send a variable from an ASPX page querystring/GET form submission and have the codebehind for that page access that variable on postback, preferably without a server control. <br /><br />Classic ASP has that handy request.querystring("foo") method of accessing such variables, but I can't see a way to access that from the codebehind, even if I update the syntax to request.querystring("foo")(0).<br /><br />If anyone has any ideas, I'd gladly give you millions of dollars to ease my suffering mind -- only I don't have a million dollars. So my undying gratitude will have to suffice.<br /><br />Thanks in advance,<br /><br />-Bret<br /><br />

Reply With Quote
  #3  
Old May 23rd, 2002, 04:46 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 23
<i><b>Originally posted by : nybble_me (nybble_me@hotmail.com)</b></i><br />Request.QueryString["FOO"]<br /><br />Use [] instead of (), at least that's how it works in the C# world.<br /><br /><br />------------<br />Julia Lerman at 5/20/2002 9:42:42 AM<br /><br />Bret-<br />I struggled with this one for a while a few weeks ago! The secret is that you have to shove the query string into a special type of collection and then pull out its elements. You can use this code to then go examine the SDK for more information.<br /><br />This code is in VB.Net.<br /><br />I am grabbing the elements and putting them into pre-defined variables and textboxes.<br /><br />Here is sample code of how I accomplished it:<br />The "Request" in my first line refers to the calling form.<br /><br /> Dim oRequest As HttpRequest = Request<br /> Dim arr2 As String<br /> Dim coll As Specialized.NameValueCollection<br /> coll = Request.QueryString<br /> If coll.Count > 1 Then '1 is the submit button<br /> arr2 = CStr(coll.GetValues("id")(0))<br /> If arr2 <> vbNullString Then<br /> m_iBooksid = CStr(coll.GetValues("id")(0))<br /> txtBookTitle.Value = CStr(coll.GetValues("booktitle")(0))<br /> txtAuthor.Value = CStr(coll.GetValues("author")(0))<br /> txtPublisher.Value = CStr(coll.GetValues("pub")(0))<br /> End If<br /> End If<br /><br />Julia Lerman<br />VTdotNet User Group Coordinator<br />www.thedatafarm.com/vtdotnet<br /><br /><br />------------<br />Bret at 5/13/2002 11:20:42 AM<br /><br />Okay, this is probably a silly question, but I'm new to .NET/VB and haven't been able to find an answer to this anywhere. <br /><br />I want to send a variable from an ASPX page querystring/GET form submission and have the codebehind for that page access that variable on postback, preferably without a server control. <br /><br />Classic ASP has that handy request.querystring("foo") method of accessing such variables, but I can't see a way to access that from the codebehind, even if I update the syntax to request.querystring("foo")(0).<br /><br />If anyone has any ideas, I'd gladly give you millions of dollars to ease my suffering mind -- only I don't have a million dollars. So my undying gratitude will have to suffice.<br /><br />Thanks in advance,<br /><br />-Bret<br /><br />

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Querystring -> Codebehind?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT