📄 default.aspx
字号:
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="infoWeb.WebModules.Forums.Web._Default" %>
<%@ OutputCache Duration="60" VaryByParam="*" %>
<%@ Register TagPrefix="Forums" TagName="Header" src="Header.ascx" %>
<%@ Register TagPrefix="Forums" TagName="Footer" src="Footer.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>企事业内部信息交流系统</title>
<meta content="C#" name="CODE_LANGUAGE">
<LINK href="/ThePhile/Styles/ThePhile.css" rel="stylesheet">
<LINK href="/ThePhile/Styles/Navigator.css" rel="stylesheet">
<script language="javascript">
function DeleteForum(id)
{
if (confirm('你确定要删除此讨论区,以及相关的讨论吗?'))
{
document.forms['Forums'].elements['paramID'].value = id;
__doPostBack('DeleteForum', '');
}
}
function DeleteCategory(id)
{
if (confirm('你确定要删除此类目,以及相关的子类吗?'))
{
document.forms['Forums'].elements['paramID'].value = id;
__doPostBack('DeleteCategory', '');
}
}
</script>
</HEAD>
<body>
<form id="Forums" method="post" runat="server">
<FORUMS:HEADER id="Header" Runat="server"></FORUMS:HEADER>
<!-- hidden server controls for handling the events on the server --><input id="paramID" type="hidden" runat="server">
<asp:linkbutton id="DeleteCategory" onclick="DeleteCategory_Click" runat="server" Visible="False"></asp:linkbutton><asp:linkbutton id="DeleteForum" onclick="DeleteForum_Click" runat="server" Visible="False"></asp:linkbutton><br>
<asp:table id="CategoryBox" runat="server" Visible="False" CssClass="Forums_General" HorizontalAlign="Center" Width="500px">
<asp:TableRow CssClass="Forums_Header">
<asp:TableCell runat="server" ID="CategoryBoxHeader" ColumnSpan="2" />
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="姓名:" Font-Bold="True" Width="100px" VerticalAlign="Top" />
<asp:TableCell>
<asp:TextBox ID="CategoryName" runat="server" MaxLength="100" Width="100%" CssClass="TextBox" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="CategoryName" Display="Dynamic">
* 必须填写
</asp:RequiredFieldValidator>
<asp:TextBox ID="CategoryIDCurr" runat="server" Visible="False" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="图片链接地址:" Font-Bold="True" Width="100px" VerticalAlign="Top" />
<asp:TableCell>
<asp:TextBox ID="CategoryImageUrl" runat="server" MaxLength="100" Width="100%" CssClass="TextBox" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="位置:" Font-Bold="True" Width="100px" VerticalAlign="Top" />
<asp:TableCell>
<asp:TextBox ID="CategoryPosition" runat="server" MaxLength="3" Width="100%" CssClass="TextBox" />
<asp:CompareValidator runat="server" ControlToValidate="CategoryPosition" Type="Integer" Operator="DataTypeCheck" Display="dynamic">
* 不合法的格式
</asp:CompareValidator>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell />
<asp:TableCell HorizontalAlign="Right">
<asp:LinkButton ID="SubmitCategory" OnClick="SubmitCategory_Click" runat="server">[ <img border="0" src="./Images/OK.gif" Alt="submit"> 提交 ]</asp:LinkButton>
<asp:LinkButton ID="CancelCategory" OnClick="CancelCategory_Click" CausesValidation="False" runat="server">[ <img border="0" src="./Images/Cancel.gif" Alt="Cancel"> 取消 ]</asp:LinkButton>
</asp:TableCell>
</asp:TableRow>
</asp:table><asp:table id="ForumBox" runat="server" Visible="False" CssClass="Forums_General" HorizontalAlign="Center" Width="500px">
<asp:TableRow CssClass="Forums_Header">
<asp:TableCell runat="server" ID="ForumBoxHeader" ColumnSpan="2" />
</asp:TableRow>
<asp:TableRow runat="server" ID="ForumCategoryRow" Visible="False">
<asp:TableCell Text="Category:" Font-Bold="True" Width="100px" VerticalAlign="Top" />
<asp:TableCell>
<asp:DropDownList runat="server" ID="ForumCategory" DataTextField="CategoryName" DataValueField="CategoryID" Width="100%" CssClass="TextBox" />
<asp:TextBox ID="ForumCategoryCurr" runat="server" Visible="False" />
<asp:TextBox ID="ForumIDCurr" runat="server" Visible="False" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="姓名:" Font-Bold="True" Width="100px" VerticalAlign="Top" />
<asp:TableCell>
<asp:TextBox ID="ForumName" runat="server" MaxLength="100" Width="100%" CssClass="TextBox" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="ForumName" Display="Dynamic">
* 必须填写
</asp:RequiredFieldValidator>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="描述:" Font-Bold="True" Width="100px" VerticalAlign="Top" />
<asp:TableCell>
<asp:TextBox ID="ForumDescription" runat="server" TextMode="MultiLine" Rows="3" MaxLength="250" Width="100%" CssClass="TextBox" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="位置:" Font-Bold="True" Width="100px" VerticalAlign="Top" />
<asp:TableCell>
<asp:TextBox ID="ForumPosition" runat="server" MaxLength="3" Width="100%" CssClass="TextBox" />
<asp:CompareValidator runat="server" ControlToValidate="ForumPosition" Type="Integer" Operator="DataTypeCheck" Display="dynamic">
* 不合法的格式
</asp:CompareValidator>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell />
<asp:TableCell HorizontalAlign="Right">
<asp:LinkButton ID="SubmitForum" OnClick="SubmitForum_Click" runat="server">[ <img border="0" src="./Images/OK.gif" Alt="submit"> 提交 ]</asp:LinkButton>
<asp:LinkButton ID="CancelForum" OnClick="CancelForum_Click" CausesValidation="False" runat="server">[ <img border="0" src="./Images/Cancel.gif" Alt="Cancel"> 取消 ]</asp:LinkButton>
</asp:TableCell>
</asp:TableRow>
</asp:table><br>
<asp:datalist id="CategoriesList" runat="server" Width="100%" OnEditCommand="CategoriesList_Edit" DataKeyField="CategoryID">
<HeaderTemplate>
<table width="100%">
<tr>
<td>
<table width="100%">
<tr class="Forums_Header2">
<td width="16px" runat="server" Visible='<%# CanAdministerCategories %>'>
<asp:LinkButton ID="NewCategory" runat="server" OnClick="NewCategory_Click" CausesValidation="False">
<img border="0" src="./Images/FolderNew.gif" Alt="Create a new category">
</asp:LinkButton>
</td>
<td width="16px" runat="server" Visible='<%# CanAdministerCategories %>'>
<asp:LinkButton ID="NewForum" runat="server" OnClick="NewForum_Click" CausesValidation="False">
<img border="0" src="./Images/Folder.gif" Alt="Create a new forum">
</asp:LinkButton>
</td>
<td class="Forums_Header2" width="32px"> </td>
<td class="Forums_Header2">讨论区名称</td>
<td class="Forums_Header2" width="60px" align="center">主体</td>
<td class="Forums_Header2" width="60px" align="center">文章</td>
<td class="Forums_Header2" width="90px" align="center">最后一篇</td>
</tr>
</table>
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="100%">
<tr>
<td>
<table width="100%">
<tr class="Forums_Header">
<td width="15px" runat="server" Visible='<%# CanAdministerCategories %>'>
<asp:LinkButton CommandName="Edit" runat="server" CausesValidation="False">
<img border="0" Alt="Edit this category" src="./Images/Edit.gif">
</asp:LinkButton>
</td>
<td width="15px" runat="server" Visible='<%# CanAdministerCategories %>'>
<a href='<%# string.Format("javascript:DeleteCategory({0});",
DataBinder.Eval(Container.DataItem, "CategoryID")) %>'><img border="0" Alt="Delete this category" src="./Images/Delete.gif" />
</a>
</td>
<td width="35px" align="center">
<asp:Image Runat="server" BorderWidth="0" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "CategoryImageUrl") %>' Visible='<%# DataBinder.Eval(Container.DataItem, "CategoryImageUrl").ToString().Length > 0 %>' />
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "CategoryName") %>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<asp:DataGrid runat="server" AutoGenerateColumns="False" CssClass="Forums_General" ItemStyle-CssClass="Forums_Item" AlternatingItemStyle-CssClass="Forums_AlternatingItem" DataKeyField="ForumID" DataSource='<%# GetForumsSource(int.Parse(DataBinder.Eval(Container.DataItem, "CategoryID").ToString())) %>' OnEditCommand="ForumsGrid_Edit" ShowHeader="False" Width="100%">
<Columns>
<asp:TemplateColumn ItemStyle-Wrap="True" ItemStyle-Width="1px">
<ItemTemplate>
<asp:ImageButton Runat="server" CommandName="Edit" Visible='<%# CanAdministerCategories %>' ImageUrl="./Images/Edit.gif" AlternateText="Edit this forum" BorderWidth="0"/>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn ItemStyle-Wrap="True" ItemStyle-Width="1px">
<ItemTemplate>
<asp:HyperLink Runat="server" NavigateUrl='<%# "javascript:DeleteForum(" + DataBinder.Eval(Container.DataItem, "ForumID") + ")" %>' Visible='<%# CanAdministerCategories %>' Text="<img border=0 Alt='Delete this forum' src=./Images/Delete.gif>" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn ItemStyle-Width="32px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<img border="0" src="./Images/Folder.gif" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:HyperLink runat="server" Font-Bold="True" Text='<%# DataBinder.Eval(Container.DataItem, "ForumName") %>' NavigateUrl='<%# "Forum.aspx?ForumID=" + DataBinder.Eval(Container.DataItem, "ForumID") %>' />
<br>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ForumDescription") %>' />
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn ItemStyle-Width="60px" DataField="ForumTopics" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Center" />
<asp:BoundColumn ItemStyle-Width="60px" DataField="ForumPosts" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateColumn ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "ForumLastPostDate", "{0:MM/dd/yy}") %>
<br>
<small>
<%# DataBinder.Eval(Container.DataItem, "ForumLastPostDate", "{0:HH:mm:ss tt}") %>
</small>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</td>
</tr>
</table>
</ItemTemplate>
</asp:datalist><br>
<FORUMS:FOOTER id="Footer" Runat="server"></FORUMS:FOOTER></form>
</body>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -