|
-
May 20th, 2005, 05:59 PM
#1
Thread Starter
Frenzied Member
how to recive the hyper link passed value in visual asp.net code behind
how to recive the hyper link passed value in visual studio asp.net code behind
Hi experts. I have diffculty reciving hyper link passed value in visual studio.net code behind asp.net. I
do not know how to recive this value and use it select statment.i be happy if some expert tell me
how i can use visual studio.net 2003 wizard to create that code for me.Thank
-
May 20th, 2005, 10:02 PM
#2
Re: how to recive the hyper link passed value in visual asp.net code behind
If Visual Studio .Net could do all the work, do you think they would need programmers?
To access a Query Variable...
eg http://MyWebserver/MyApp/WebForm1.aspx?Msg=Hello+world
The bold section of that url is called the Query String
you can have multiple variables in here eg.
http://MyWebserver/MyApp/WebForm1.aspx?Var1=Val1&Var2=Val2
This url has two parameters, Var1 and Var2
To get these values you would put this in your code behind....
VB Code:
Option Strict On
Option Explicit On
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim Var1 As String = Request.QueryString.Item("Var1")
Dim Var2 As String = Request.QueryString.Item("Var2")
'Check to make sure the variables were set
If IsNothing(Var1) Then
'Var1 was not Set
Var1 = "This Value was Not set!"
End If
If IsNothing(Var2) Then
'Var2 was not set
Var2 = "This Value was Not set!"
End If
'Display the Variables
Response.Write("The Value of Var1 is: " & Var1 & " <br />") ' <br /> denotes a new line
Response.Write("The Value of Var2 is: " & Var2 & " <br />")
End Sub
End Class
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
May 21st, 2005, 04:34 AM
#3
Thread Starter
Frenzied Member
Re: how to recive the hyper link passed value in visual asp.net code behind
Many thanks to your reply. your code is very helpfull. if i want add a hyper link to datagrid which holds a primary key of perticuler record how i can accomplish that part. i want use the passed value in next page using your method and use it in select statement.Thanks
Last edited by tony007; May 21st, 2005 at 05:03 AM.
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
|