|
-
May 2nd, 2003, 05:20 AM
#1
Thread Starter
Junior Member
passing values via URL
Hey,
Just a wee Q...I am trying to pass the value from my textbox via a URL and am unsure how to get this value.
My link reads:
Code:
<a href="AddSequence.aspx?RepNo=<%#txtRepNo.Text%>" style="COLOR: #0000ff">Add Sequence to this Rep</a>
but no luck! How can I pass this value?
-
May 2nd, 2003, 10:45 AM
#2
PowerPoster
Re: passing values via URL
Originally posted by kto
Hey,
Just a wee Q...I am trying to pass the value from my textbox via a URL and am unsure how to get this value.
My link reads:
Code:
<a href="AddSequence.aspx?RepNo=<%#txtRepNo.Text%>" style="COLOR: #0000ff">Add Sequence to this Rep</a>
but no luck! How can I pass this value?
Now, I am assuming you are using asp.net. So you just use a namevaluecollection object. The namevaluecollection is in the System.Collections.Specialized namespace:
Dim col As NameValueCollection = Request.QueryString
Dim RepNo As String = col.Get("RepNo").ToString()
-
May 8th, 2003, 10:11 AM
#3
Thread Starter
Junior Member
Fraid I'm using VB.NET so I can't utilise the NameValueCollection.
Ordinarily the user clicks on the record from within a datagrid so it is easy to pass the RepNo value to the receiving page (AddSequence), however, the page I am trying to get the textbox value from is on a simple form (just used to display the actual record) and I don't really want to change how the page retrieves the RepNo value (i.e. Request.QueryString()).
There must be a way to get that value when the user clicks on the link and send it along with my URL, no?!
-
May 9th, 2003, 04:53 AM
#4
Thread Starter
Junior Member
Resolved
for any of you crazy cats who are looking to pass values via URL I found the simple solution by declaring a session variable in my VB e.g.
Code:
Session("repno") = RepNo
and then accessing that session variable from my HTML like so...
Code:
<a href="AddSequence.aspx?RepNo=<%=session("repno")%>" style="COLOR: #0000ff">Add Sequence to this Rep</a>
ahoy!
-
May 9th, 2003, 10:07 AM
#5
PowerPoster
Re: Resolved
Originally posted by kto
for any of you crazy cats who are looking to pass values via URL I found the simple solution by declaring a session variable in my VB e.g.
Code:
Session("repno") = RepNo
and then accessing that session variable from my HTML like so...
Code:
<a href="AddSequence.aspx?RepNo=<%=session("repno")%>" style="COLOR: #0000ff">Add Sequence to this Rep</a>
ahoy!
Be careful though. I think if the session variable doesn't exist yet, and you try to use it, it will through an error. The book I have says to check for a null value first. It is in C# though, don't know how VB.Net handles it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|