add the multiplication excercise

This commit is contained in:
Andreas Zweili 2017-12-02 09:53:50 +01:00
parent 21ba54ac09
commit d4bcc90753
4 changed files with 113 additions and 0 deletions

View File

@ -65,6 +65,7 @@
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Content Include="multiplication_table.aspx" />
<Content Include="packages.config" />
<Content Include="random_numbers.aspx" />
<Content Include="StringConverter.aspx" />
@ -82,6 +83,13 @@
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="multiplication_table.aspx.cs">
<DependentUpon>multiplication_table.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="multiplication_table.aspx.designer.cs">
<DependentUpon>multiplication_table.aspx</DependentUpon>
</Compile>
<Compile Include="random_numbers.aspx.cs">
<DependentUpon>random_numbers.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>

View File

@ -0,0 +1,27 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="multiplication_table.aspx.cs" Inherits="first_webform.multiplication_table" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css" media="screen">
table{
border-collapse:collapse;
border:1px solid #000000;
}
table td{
border:1px solid #000000;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:Table ID="Table1" runat="server">
</asp:Table>
</form>
</body>
</html>

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace first_webform
{
public partial class multiplication_table : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
// Total number of rows.
int rowCnt;
// Current row count.
int rowCtr;
// Total number of cells per row (columns).
int cellCtr;
// Current cell counter
int cellCnt;
rowCnt = 10;
cellCnt = 10;
for (rowCtr = 1; rowCtr <= rowCnt; rowCtr++)
{
// Create new row and add it to the table.
TableRow tRow = new TableRow();
Table1.Rows.Add(tRow);
for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
{
// Create a new cell and add it to the row.
TableCell tCell = new TableCell();
tCell.Text = Convert.ToString(rowCtr * cellCtr);
tRow.Cells.Add(tCell);
}
}
}
}
}
}

View File

@ -0,0 +1,33 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace first_webform {
public partial class multiplication_table {
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// Table1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Table Table1;
}
}