ONLINEPROOFINGSITE.COM

proof test result - www.onlineproofingsite.com

Menu


You can format the table and content in the table as you see fit. Feel free to create styles so that your table and the content within it


becomes more attractive. 5. You are now ready to begin adding all the web controls for the New User Registration form. First, place your cursor in the second cell in the Name row and choose Insert, ASP.NET Objects, asp:TextBox. The asp:TextBox dialog appears. Give your new TextBox the ID name and click OK. 6. Repeat step 5 for the rest of the web controls. The following chart shows the fields, the appropriate web control to be inserted, and the unique ID to be given to each of the web controls. Field Name Form Object ID Name TextBox name Username TextBox username Password TextBox password Email TextBox email Phone TextBox phonenumber Headshot Location TextBox headshotloc BillingShippingAddress TextBox billshipaddress BillingShippingCity TextBox billshipcity BillingShippingState TextBox billshipstate BillingShippingZip TextBox billshipzip Button Submit   The result of inserting all the form objects is shown in Figure 26.22. Figure 26.22. Insert all the form objects for the New User Registration page. [View full size image] 7. The one object we haven't added yet is a control to hold the value that we'll use for the DepartmentID. Earlier in the chapter, we mentioned that new employees inserted into the Employees table will be associated with department number 2, Administration, when they're first created. It will be the administrator's responsibility to go back in and change the employee's corresponding department later. Because this is the case, we need some way of holding the default department ID value of 2 so that the Insert Record server behavior can read it and subsequently write that value to the database table. To hold that value, we'll use a TextBox control, set its Text property to 2, and then set the Visible property (manually) to False. You can do this by placing your cursor in any cell in the form and choosing Insert, ASP.NET Objects, asp:TextBox. When the asp:TextBox dialog appears, enter the ID departmentid, enter a text value of 2, and click OK. The TextBox is inserted onto the page. With the TextBox selected, immediately switch to Split view and enter the visible="false" attribute and value in the TextBox control's opening tag. The result of the modification is shown in Figure 26.23. Figure 26.23. Add a TextBox control and add the visible="false" attribute and value to the control in Code view. [View full size image] Save the page as register.aspx and run it in the browser by pressing F12. Notice that the TextBox with the default value of 2 isn't visible on the page. Although it's not visible on the page here, we can use the control and value programmatically in the Insert Record server behavior, covered later. Validating the Form with Validation Controls Now that you have the form created, you are ready to begin inserting the data into the database. But before you begin, make sure that you have valid data going in. Because the database tables explicitly define data types for each field, you'll want to make sure that the data the user enters is the same as what is going to be accepted by the database table; otherwise, errors will occur. The use of Validation controls allow you to check for invalid data and return an error message before the data is actually sent to the database table.