MCAD/MCSD DEVELOPING WEB APPLICATION WITH VISUAL BASIC.NET and VISUAL C#.NET is a very good book to start web programming with, While http://msdn2.microsoft.com/en-us/library/ is a very good website for reference.
Well, they want a form or table, where user can enter data, say, 3 columns and 4 rows.
Notification type Notification information Preference Text Message ____________________ _________ Fax ____________________ _________ Tel ____________________ _________
Button
After entering information, user will click the button and a message will be sent into some table in sql server database. Preference is a number 1-5. Duplicated numbers are not allowed. We can’t have both Tel and Fax as 1. Message should be sorted, like: 1 Notification information Notification type. 2 …. Null Preference is allowed.When users click the button, I create a hash table and put data into hash table. Hash table is a collection of key/value pair where, given a key it can retrieve the corresponding value. Hash table throw exception at duplicated value. So when duplicated values are entered, catch block use a piece of javascript(asp.net can’t pop up windows) to pop up a window to inform users. Hash table won’t sort. So I put the key of hash table in an arraylist, and use sort() method of arraylist to sort the key and retrieve its corresponding value and append it to string.
Here, I simply print the message instead of inserting into database. The lab contains 3 files. Default.aspx, Default.aspx.cs, and Web.Config. Web.Config is the default one. I didn’t do anything to it.
Default.aspx.cs:
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Text; using System.Collections;
public partial class _Default : System.Web.UI. Page
Can't post aspx page. It shows as a table instead of code. I just create a table drag and drop textboxes and dropdownlists into table cells. In the catch block above, "string JString" should be initialized. Instead of showing the code it pops up a window here. When I first did the work, it shows the code but doesn't pop up windows. I feel I am both a bad blogger and a bad programmer. :) Will find a way to post it.