This is a small tutorial on getting/reading submitted data from ASP.NET pages.
In PHP, you write a form, put in your inputs (i.e. test_name), then some buttons. Usually you would catch this by doing a:
echo $_POST [ 'test_name' ]; |
In ASP.NET C# you get your post variables by using Request.Form:
Request.Form[ "test_name" ] |
To send the data, with your submit button, simply have the METHOD=”?action=update” or if you’re using an ASP Button control, the PostBackURL should be “?action=update”
Now you need to catch the post back, and do something with the information you’ve sent to the server.
To see what button has been clicked, use QueryString:
Request.QueryString[ "action" ]; |
Put all this together:
string action = Request.QueryString[ "action" ]; if (action == "update" ) { name = Request.Form[ "test_name" ]; } |
Easy!
No comments:
Post a Comment