| 0 | using System; |
| 1 | |
| 2 | public partial class _Default : System.Web.UI.Page |
| 3 | { |
| 4 | protected void Page_Load(object sender, EventArgs e) |
| 5 | { |
| 6 | string contentString = null; |
| 7 | string name = Request.Form.Get("name"); |
| 8 | string birthdate = Request.Form.Get("birthdate"); |
| 9 | string occupation = Request.Form.Get("occupation"); |
| 10 | |
| 11 | try |
| 12 | { |
| 13 | if (name.Length > 0) |
| 14 | { |
| 15 | contentString += "Hello " + name + ", thanks for filling out the form.<br>"; |
| 16 | } |
| 17 | } |
| 18 | catch { } |
| 19 | try |
| 20 | { |
| 21 | if (birthdate.Length > 0) |
| 22 | { |
| 23 | contentString += "I see you were born " + birthdate + ".<br>"; |
| 24 | } |
| 25 | } |
| 26 | catch { } |
| 27 | try |
| 28 | { |
| 29 | if (occupation.Length > 0) |
| 30 | { |
| 31 | contentString += "How do you like being a " + occupation + "?<br>"; |
| 32 | } |
| 33 | } |
| 34 | catch { } |
| 35 | |
| 36 | contentString += @"<form method='POST' action='default.aspx'> |
| 37 | <table> |
| 38 | <tr> |
| 39 | <td>Name</td> |
| 40 | <td><input name='name' value='" + name + @"'></td> |
| 41 | </tr><tr> |
| 42 | <td>Birth Date</td> |
| 43 | <td><input name='birthdate' value='" + birthdate + @"'></td> |
| 44 | </tr><tr> |
| 45 | <td>Occupation</td> |
| 46 | <td><input name='occupation' value='" + occupation + @"'></td> |
| 47 | </tr><tr> |
| 48 | <td colspan=2><input type='submit' value='Submit'></td> |
| 49 | </tr> |
| 50 | </table> |
| 51 | </form>"; |
| 52 | content.InnerHtml = contentString; |
| 53 | } |
| 54 | } |