I'm trying to pass just a few parameters to a page, and I can't even get them in there... Help!
Is there a tutorial on here that shows an EASY method for pulling the data that's passed to a dotNet page?
Thanks for the help.Don't understand what's so difficult. For example:
QueryString (http://www.domain.com/default.aspx?id=1)
Request.QueryString [ "id" ]; // C#Form
Request.QueryString ( "id" ) ' VB
Request.Form [ "id" ]; // C#Params
Request.Form ( "id" ) ' VB
Request.Params [ "id" ]; // C#If you need to know how to access them dynamically (i.e. not knowing the keys before hand) see the examples provided forHttpRequest.QueryString andHttpRequest.Form
Request.Params ( "id" ) ' VB
HTH
if this is your link
out.aspx?id=1&name=Jake
In out.aspx
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
Dim intID As Integer
Dim strName As String
intID = Request.QueryString("id")
strName = Request.QueryString("name")
response.write("Hello " & strName & " you clicked link # " & intID)
End If
End Sub
As for form variables, you don't post them to a new page like you're thinking. You post the form to itself and in the code section you just reference the control name.
If you had a textbox called fName then fName.text is equal to request.form("fname").
0 comments:
Post a Comment