110 likes | 287 Views
XML with ASP using ASP:DataList. Please use speaker notes for additional information!. <EMPLOYEE> <FIRST_NAME>Carl</FIRST_NAME> <LAST_NAME>Hersey</LAST_NAME> <DEPT>Foreign</DEPT> <JOB>Consultant</JOB> <SALARY>60000</SALARY> </EMPLOYEE>
E N D
XML with ASPusing ASP:DataList Please use speaker notes for additional information!
<EMPLOYEE> <FIRST_NAME>Carl</FIRST_NAME> <LAST_NAME>Hersey</LAST_NAME> <DEPT>Foreign</DEPT> <JOB>Consultant</JOB> <SALARY>60000</SALARY> </EMPLOYEE> </PERSONNEL> <?xml version="1.0" ?> <!-- Data for Payroll --> <PERSONNEL> <EMPLOYEE> <FIRST_NAME>Stephen</FIRST_NAME> <LAST_NAME>Daniels</LAST_NAME> <DEPT>Sports</DEPT> <JOB>Reporter</JOB> <SALARY>50000</SALARY> </EMPLOYEE> <EMPLOYEE> <FIRST_NAME>Al</FIRST_NAME> <LAST_NAME>Richards</LAST_NAME> <DEPT>Engineering</DEPT> <JOB>Consultant</JOB> <SALARY>95000</SALARY> </EMPLOYEE> <EMPLOYEE> <FIRST_NAME>Jennifer</FIRST_NAME> <LAST_NAME>Ames</LAST_NAME> <DEPT>Foreign</DEPT> <JOB>Consultant</JOB> <SALARY>55000</SALARY> </EMPLOYEE> <EMPLOYEE> <FIRST_NAME>Sarah</FIRST_NAME> <LAST_NAME>Grant</LAST_NAME> <DEPT>Scientific</DEPT> <JOB>Web</JOB> <SALARY>50000</SALARY> </EMPLOYEE>
<%@ Import Namespace="System.Data" %> <script runat="server"> sub Page_Load if Not Page.IsPostBack then dim payrollData=New DataSet payrollData.ReadXml(MapPath("payroll.xml")) payrollSet.DataSource=payrollData payrollSet.DataBind() end if end sub </script> <html> <body> <form runat="server"> <h2>Employee List</h2> <asp:DataList id="payrollSet" gridlines="both" runat="server"> <HeaderTemplate> <b>Last Name / First Name / Dept / Job / Salary</b> </HeaderTemplate> <ItemTemplate> <%#Container.DataItem("LAST_NAME")%> / <%#Container.DataItem("FIRST_NAME")%> / <%#Container.DataItem("DEPT")%> / <%#Container.DataItem("JOB")%> / <%#Container.DataItem("SALARY")%> </ItemTemplate> </asp:DataList> </form> </body> </html>
<%@ Import Namespace="System.Data" %> <script runat="server"> sub Page_Load if Not Page.IsPostBack then dim payrollData=New DataSet payrollData.ReadXml(MapPath("payroll.xml")) payrollSet.DataSource=payrollData payrollSet.DataBind() end if end sub </script> <html> <body> <form runat="server"> <h2>Employee List</h2> <asp:DataList id="payrollSet" gridlines="both" runat="server"> <HeaderTemplate> <b>Employees</b> </HeaderTemplate> <ItemTemplate> <%#Container.DataItem("LAST_NAME")%>, <%#Container.DataItem("FIRST_NAME")%> has a Job of: <%#Container.DataItem("JOB")%> in Dept: <%#Container.DataItem("DEPT")%> with a Salary of: <%#Container.DataItem("SALARY")%> </ItemTemplate> </asp:DataList> </form> </body> </html>
<%@ Import Namespace="System.Data" %> <script runat="server"> sub Page_Load if Not Page.IsPostBack then dim payrollData=New DataSet payrollData.ReadXml(MapPath("payroll.xml")) payrollSet.DataSource=payrollData payrollSet.DataBind() end if end sub </script> <html> <body> <form runat="server"> <h2>Employee List</h2> <asp:DataList id="payrollSet" gridlines="both" runat="server"> <HeaderTemplate> <tr> <th>Last Name</th> <th>First Name</th> <th>Dept</th> <th>Job</th> <th>Salary</th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td><%#Container.DataItem("LAST_NAME")%></td> <td><%#Container.DataItem("FIRST_NAME")%></td> <td><%#Container.DataItem("DEPT")%></td> <td><%#Container.DataItem("JOB")%></td> <td><%#Container.DataItem("SALARY")%></td> </tr> </ItemTemplate> </asp:DataList> </form> </body> </html>
<%@ Import Namespace="System.Data" %> <script runat="server"> sub Page_Load if Not Page.IsPostBack then dim optionData=New DataSet optionData.ReadXml(MapPath("bccopt.xml")) optionSet.DataSource=optionData optionSet.DataBind() end if end sub </script> <html> <body> <form runat="server"> <h2>Option List</h2> <asp:DataList id="optionSet" gridlines="both" runat="server"> <HeaderTemplate> <tr> <th>Name</th> <th>Advisor</th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td><%#Container.DataItem("optionname")%></td> <td><%#Container.DataItem("optionadv")%></td> </tr> </ItemTemplate> </asp:DataList> </form> </body> </html>
<?xml version="1.0" ?> <!-- Data for BCC Departments --> <bcc> <option> <optionname>Programming</optionname> <optionadv>Grocer</optionadv> </option> <option> <optionname>Webmaster</optionname> <optionadv>Grocer</optionadv> </option> <option> <optionname>Networking</optionname> <optionadv>Arruda</optionadv> </option> <option> <optionname>Business Information</optionname> <optionadv>Grocer</optionadv> </option> <option> <optionname>Multimedia/Internet</optionname> <optionadv>Vieira</optionadv> </option> <option> <optionname>Computer Science</optionname> <optionadv>Ferreira</optionadv> </option> <option> <optionname>Information Systems</optionname> <optionadv>Grocer</optionadv> </option> <option> <optionname>Accounting</optionname> <optionadv>Garand</optionadv> </option>
<option> <optionname>Marketing Management</optionname> <optionadv>Leonard</optionadv> </option> <option> <optionname>Retail Management</optionname> <optionadv>Dickens</optionadv> </option> <option> <optionname>Business Administration</optionname> <optionadv>Leonard</optionadv> </option> </bcc>
<?xml version="1.0" ?> <!-- Data for BCC Departments --> <bcc> <department> <deptname>Computer Information Systems</deptname> <optiontype> <typename>Career</typename> <option> <optionname>Programming</optionname> <optionadv>Grocer</optionadv> </option> <option> <optionname>Webmaster</optionname> <optionadv>Grocer</optionadv> </option> <option> <optionname>Networking</optionname> <optionadv>Arruda</optionadv> </option> <option> <optionname>Business Information</optionname> <optionadv>Grocer</optionadv> </option> <option> <optionname>Multimedia/Internet</optionname> <optionadv>Vieira</optionadv> </option> </optiontype> <optiontype> <typename>Transfer</typename>
<option> <optionname>Computer Science</optionname> <optionadv>Ferreira</optionadv> </option> <option> <optionname>Information Systems</optionname> <optionadv>Grocer</optionadv> </option> </optiontype> </department> <department> <deptname>Business</deptname> <optiontype> <typename>Career</typename> <option> <optionname>Accounting</optionname> <optionadv>Garand</optionadv> </option> <option> <optionname>Marketing Management</optionname> <optionadv>Leonard</optionadv> </option> <option> <optionname>Retail Management</optionname> <optionadv>Dickens</optionadv> </option> </optiontype> <optiontype> <typename>Transfer</typename> <option> <optionname>Business Administration</optionname> <optionadv>Leonard</optionadv> </option> </optiontype> </department> </bcc>
<%@ Import Namespace="System.Data" %> <script runat="server"> sub Page_Load if Not Page.IsPostBack then dim optionData=New DataSet optionData.ReadXml(MapPath("bccoptions.xml")) optionSet.DataSource=optionData.Tables("option") optionSet.DataBind() end if end sub </script> <html> <body> <form runat="server"> <h2>Option List</h2> <asp:DataList id="optionSet" gridlines="both" runat="server"> <HeaderTemplate> <tr> <th>Name</th> <th>Advisor</th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td><%#Container.DataItem("optionname")%></td> <td><%#Container.DataItem("optionadv")%></td> </tr> </ItemTemplate> </asp:DataList> </form></body></html>