Page 169 - DCAP312_WEB_TECHNOLOGIES_II
P. 169

Unit 8: Creating More Advanced ASP.NET



                     #region Fields                                                               Notes
                     protected string businessObj;
                     protected string objPropertyName;
                     protected Control ctrlObj;
                     protected string ctrlPropertyName;
                     #endregion
                     #region Properties
                     public string BusinessObject {
                     get { return businessObj; }
                     set { businessObj = value; }
                     }
                     public string BusinessObjectPropertyName
                     {
                     get { return objPropertyName; }
                     set { objPropertyName = value; }
                     }
                     public Control ControlObject
                     {
                     get { return ctrlObj; }
                     set { ctrlObj = value; }
                     }
                     public string ControlObjectPropertyName {
                     get { return ctrlPropertyName; }
                     set { ctrlPropertyName = value; }
                     }
                     #endregion
                     }
            Build the UI
            Finally, you need to build the user interface, which contains a Label that displays the employee's
            code, two TextBoxes that display the employee’s name and address respectively, and a Button
            control.

            The following code snippet shows the controls used in the .aspx file for the sample application:
                     <asp:label id=lblEmpCode runat= “server”
                     Text='<%# DataBinder.Eval(employeeDO, “Code”) %>'>
                     </asp:label>
                     <asp:textbox id=txtEmpName runat= “server”
                     Text='<%# DataBinder.Eval(employeeDO, “EmpName”) %>'>
                     </asp:textbox>
                     <asp:textbox id=txtEmpAddress runat= “server”
                     Text='<%# DataBinder.Eval(employeeDO, “EmpAddress”) %>'>
                     </asp:textbox>



                                             LOVELY PROFESSIONAL UNIVERSITY                                   163
   164   165   166   167   168   169   170   171   172   173   174