add files for a new asp.net excercise

This commit is contained in:
Andreas Zweili 2017-11-29 21:12:57 +01:00
parent 380d2cdd68
commit 4fd507f961
4 changed files with 87 additions and 0 deletions

View File

@ -77,6 +77,7 @@
<ItemGroup>
<Content Include="Default.aspx" />
<Content Include="Global.asax" />
<Content Include="titles.aspx" />
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
@ -99,6 +100,13 @@
<Compile Include="StringConverter.aspx.designer.cs">
<DependentUpon>StringConverter.aspx</DependentUpon>
</Compile>
<Compile Include="titles.aspx.cs">
<DependentUpon>titles.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="titles.aspx.designer.cs">
<DependentUpon>titles.aspx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />

View File

@ -0,0 +1,15 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="titles.aspx.cs" Inherits="first_webform.titles" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace first_webform
{
public partial class titles : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
for (int i = 0; i < 6; i++)
{
var h1 = new HtmlGenericControl("h1");
string chapter_number = Convert.ToString(i + 1);
h1.InnerHtml = "Kapitel " + chapter_number;
form1.Controls.Add(h1);
for (int j = 0; j < 3 ; j++)
{
var h2 = new HtmlGenericControl("h2");
string sub_chapter_number = Convert.ToString(j + 1);
h2.InnerHtml = "Kapitel " + chapter_number + "." + sub_chapter_number;
form1.Controls.Add(h2);
}
}
}
}
}
}

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <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 titles
{
/// <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;
}
}