GET/POST in ASP.Net

M

MikeB

Hi, for an assignment I have to write a function that can write to a
database and then also update the data.

I would like to use the same web form (page?) to write the data as the
one to update the data. All I want to have different is to display
some fields as protected and hide the password validation field.

So I thought if I create a simple html page with GET or POST data I
could retrieve the data in my LOAD event to decide which fields to
show or make read-only

The html page would look like this

<html>
<body>
<a HREF="Assignment6.aspx?fn=Register"> Register as a new user</a>
<br>
<a HREF="Assignment6.aspx?fn=Update">Update member data</a>
</body>
</html>

I also know in Javascript I can retrieve the data by coding
fn = request("fn");

My question is if I can either
a) expose the javascript variable fn to my asp.net VB code or
b) is there a vb method to obtain that data?

I've been looking at the help and at web pages for a few hours now and
it seems so complicated that I can hardly believe I'm looking at the
right stuff.

Thanks.
 
G

Guest

Hi, for an assignment I have to write a function that can write to a
database and then also update the data.

I would like to use the same web form (page?) to write the data as the
one to update the data. All I want to have different is to display
some fields as protected and hide the password validation field.

So I thought if I create a simple html page with GET or POST data I
could retrieve the data in my LOAD event to decide which fields to
show or make read-only

The html page would look like this

<html>
<body>
<a HREF="Assignment6.aspx?fn=Register"> Register as a new user</a>
<br>
<a HREF="Assignment6.aspx?fn=Update">Update member data</a>
</body>
</html>

I also know in Javascript I can retrieve the data by coding
fn = request("fn");

My question is if I can either
a) expose the javascript variable fn to my asp.net VB code or
b) is there a vb method to obtain that data?

I've been looking at the help and at web pages for a few hours now and
it seems so complicated that I can hardly believe I'm looking at the
right stuff.

Thanks.

You need the Request.QueryString

If Request.QueryString("fn") = "Register" then
.....
else if Request.QueryString("fn") = "Update" then
.....
End If
 
D

darrel

You need the Request.QueryString
If Request.QueryString("fn") = "Register" then
....
else if Request.QueryString("fn") = "Update" then
....
End If

But doesnt' that defeat the purpose of using ASP.net to begin with?

Normally, you do this via the postback. Which handles most of this for you.

So, you may have a textbox:

asp:textbox id="myTextBox"

and then to grab the value on the postback, all you need to do is:

myValue = myTextBox.text

-Darrel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top