2. BoardEditorFormControl.ascx 파일을 열고 다음과 같이 코드를 작성한다. 이 웹 폼 사용자 정의 컨트롤은 BoardWrite, BoardModify, BoardReply 세 페이지에서 공통적으로 사용한다.
▼ ~/DotNetNote/Controls/BoardEditorFormControl.ascx
<%@ Control Language=“C#” AutoEventWireup=“true”
CodeBehind=“BoardEditorFormControl.ascx.cs”
Inherits=“MemoEngine.DotNetNote.Controls.BoardEditorFormControl” %>
<style>
.BoardWriteFormTableLeftStyle {
width: 100px; text-align:right;
}
</style>
<h2 style=“text-align:center;”>게시판</h2>
<asp:Label ID=“lblTitleDescription” runat=“server” ForeColor=”#ff0000”>
</asp:Label>
<hr />
<table style=“width:600px; border-collapse: collapse;
padding: 5px; margin-left:auto; margin-right:auto;”>
<% if (!String.IsNullOrEmpty(Request.QueryString[“Id”]) &&
FormType == DotNetNote.Models.BoardWriteFormType.Modify) { %>
<tr>
<td class=“BoardWriteFormTableLeftStyle”>
<span style=“color: #ff0000;”></span>번 호
</td>
<td style=“width:500px;”>
<%= Request.QueryString[“Id”] %>
</td>
</tr>
<% } %>
<tr>
<td class=“BoardWriteFormTableLeftStyle”>
<span style=“color: #ff0000;”></span>이 름
</td>
<td style=“width:500px;”>
<asp:TextBox ID=“txtName” runat=“server” MaxLength=“10”
Width=“150px” CssClass=“form-control”></asp:TextBox>
<asp:RequiredFieldValidator ID=“valName” runat=“server”
ErrorMessage=“* 이름을 작성해 주세요.”
ControlToValidate=“txtName” Display=“None”
SetFocusOnError=“True”></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style=“text-align:right;”>E-mail
</td>
<td>
<asp:TextBox ID=“txtEmail” runat=“server”
MaxLength=“80” Width=“200px” CssClass=“form-control”
style=“display:inline-block;”></asp:TextBox>
<span style=“color:#aaaaaa;font-style:italic”>(Optional)</span>
<asp:RegularExpressionValidator ID=“valEmail” runat=“server”
ErrorMessage=“* 메일 형식이 올바르지 않습니다.”
ControlToValidate=“txtEmail” Display=“None”
ValidationExpression=
“\w+([-+.]\w+)@\w+([-.]\w+).\w+([-.]\w+)“
SetFocusOnError=“True”></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td style=“text-align:right;”>Homepage</td>
<td>
<asp:TextBox ID=“txtHomepage” runat=“server”
CssClass=“form-control” style=“display:inline-block;”
MaxLength=“80” Width=“300px”></asp:TextBox>
<span style=“color:#aaaaaa;font-style:italic;”>(Optional)</span>
<asp:RegularExpressionValidator ID=“valHomepage” runat=“server”
ErrorMessage=“