2009年8月13日木曜日

第 7 章 掲示板を作ろう

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="keiji_main.aspx.cs" Inherits="Chap7_keiji_main" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>掲示板</title>
</head>
<body style="background-color: #bbcccc;">
<form id="form1" runat="server">
<div>
<span style="color: #000080"></span>
<h2>
<span style="color: #000080">掲示板</span></h2>
<asp:LinkButton ID="Button_Refresh" runat="server" OnClick="Button_Refresh_Click">更新</asp:LinkButton><br />
<br />
<asp:Panel ID="Panel_Subject" runat="server" Style="float: left">
<asp:GridView ID="GridView_Subject" runat="server" AutoGenerateColumns="False" BorderStyle="Ridge"
BorderWidth="3px"
ShowHeader="False" Style="font-size: small; overflow: visible; clip: rect(auto 20px auto auto)"
Width="150px" onrowcommand="GridView_Subject_RowCommand">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID">
<ItemStyle BorderStyle="None" HorizontalAlign="Right" Width="20px" Wrap="False" />
</asp:BoundField>
<asp:ButtonField CommandName="Select" DataTextField="Title" Text="タイトル">
<ItemStyle BorderStyle="None" />
</asp:ButtonField>
<asp:BoundField DataField="ReplyNum" DataFormatString="({0})" HeaderText="返信数">
<ItemStyle BorderStyle="None" HorizontalAlign="Right" />
</asp:BoundField>
</Columns>
<RowStyle Wrap="False" />
<SelectedRowStyle Font-Bold="True" ForeColor="Navy" />
</asp:GridView>
<asp:Button ID="Button_NewSubject" runat="server" OnClick="Button_NewSubject_Click"
Text="新しいテーマ" /></asp:Panel>
<asp:Panel ID="Panel_Reply" runat="server" Width="500px" BorderStyle="Outset" BorderWidth="2px">
<br />
&nbsp; &nbsp; &nbsp;<asp:Literal ID="Literal1" runat="server" Text="テーマ番号:"></asp:Literal>
<asp:Literal ID="Literal_SubjectID" runat="server"></asp:Literal><br />
<table cellpadding="0" cellspacing="0" style="border-right: gray thin solid; border-top: gray thin solid;
border-left: gray thin solid; border-bottom: gray thin solid; left: 20px; position: relative; top: 0px;" width="400" id="TABLE_Subject" visible="true">
<tr>
<td style="height: 20px; background-color: #cc99ff;">
&nbsp;<asp:Label ID="Label_Person" runat="server" Text="名前"></asp:Label>&nbsp; (<asp:Label
ID="Label_Date" runat="server" Text="時刻"></asp:Label>)</td>
</tr>
<tr>
<td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
<asp:Literal ID="Literal_SubjectText" runat="server"></asp:Literal></td>
</tr>
</table>
<asp:DataList ID="DataList_Reply" runat="server" CellPadding="0" CellSpacing="5"
ShowHeader="False" Style="left: 40px; position: relative; top: 0px" OnItemDataBound="DataList_Reply_ItemDataBound">
<ItemTemplate>
<table cellpadding="0" cellspacing="2" style="width: 400px">
<tr>
<td style="background-color: #90ee90; height: 20px;">
<asp:Literal ID="R_Person" runat="server" Text='<%# Eval("Person") %>'></asp:Literal>
&nbsp; (<asp:Literal ID="R_Date" runat="server" Text='<%# Eval("Date") %>'></asp:Literal>
)</td>
</tr>
<tr>
<td>
<asp:Literal ID="R_Text" runat="server" Text='<%# Eval("Text") %>'></asp:Literal>
</td>
</tr>
</table>
</ItemTemplate>
<ItemStyle BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px" />
<HeaderTemplate>
&nbsp;&nbsp;<br />
&nbsp;
</HeaderTemplate>
<HeaderStyle BorderColor="#000040" BorderStyle="Solid" BorderWidth="1px" />
</asp:DataList>
<asp:Button ID="Button_NewReply" runat="server" OnClick="Button_NewReply_Click" Text="返事を書く" style="left: 40px; position: relative" /><br />
<asp:Panel ID="Panel_ReplyAdd" runat="server" Height="162px" Style="left: 39px; position: relative; top: 0px;"
Visible="False" Width="410px">
<br />
&nbsp;名前:
<asp:DropDownList ID="R_Person_Input" runat="server" DataSourceID="XmlDataSource1" DataTextField="Name" DataValueField="Name">
</asp:DropDownList><br />
&nbsp;コメント:<br />
<asp:TextBox ID="R_Text_Input" runat="server" Height="50px" Style="overflow: auto"
TextMode="MultiLine" Width="400px"></asp:TextBox><br />
&nbsp;<asp:Button ID="R_Button_Add" runat="server" OnClick="R_Button_Add_Click" Text="登録" /><br />
&nbsp;<asp:Label ID="R_Error" runat="server" ForeColor="Red"></asp:Label></asp:Panel>
<br />
</asp:Panel>
<asp:Panel ID="Panel_SubjectAdd" runat="server" Height="210px" Visible="False" Width="660px" style="clear: both;">
<hr />
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Chap7/Data/Persons.xml">
</asp:XmlDataSource>
名前:
<asp:DropDownList ID="S_Person_Input" runat="server" DataSourceID="XmlDataSource1" DataTextField="Name" DataValueField="Name">
</asp:DropDownList><br />
タイトル:
<asp:TextBox ID="S_Title_Input" runat="server" MaxLength="16" Width="300px"></asp:TextBox><br />
&nbsp;コメント:<br />
<asp:TextBox ID="S_Text_Input" runat="server" Height="50px" Style="overflow: auto"
TextMode="MultiLine" Width="400px"></asp:TextBox><br />
&nbsp;<asp:Button ID="S_Button_Add" runat="server" OnClick="S_Button_Add_Click" Text="登録" /><br />
<asp:Label ID="S_Error" runat="server" ForeColor="Red"></asp:Label></asp:Panel>
&nbsp;
<br />
<a href="keiji_manage.aspx" style="clear: both">掲示板管理画面へ</a></div>
</form>
</body>
</html>


終了。

0 コメント:

コメントを投稿