📄 default.aspx
字号:
<%@ Register TagPrefix="Forums" TagName="Footer" src="Footer.ascx" %>
<%@ Register TagPrefix="Forums" TagName="Header" src="Header.ascx" %>
<%@ OutputCache Duration="60" VaryByParam="*" %>
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="infoWeb.WebModules.Forums.Web._Default" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Forums</title>
<meta name="CODE_LANGUAGE" Content="C#">
<link href="/ThePhile/Styles/ThePhile.css" rel="stylesheet">
<link href="/ThePhile/Styles/Navigator.css" rel="stylesheet">
<script language="javascript">
function DeleteForum(id)
{
if (confirm('Are you sure that you want to delete this forum and all its discussions?'))
{
document.forms['Forums'].elements['paramID'].value = id;
__doPostBack('DeleteForum', '');
}
}
function DeleteCategory(id)
{
if (confirm('Are you sure that you want to delete this category and all its sub-forums?'))
{
document.forms['Forums'].elements['paramID'].value = id;
__doPostBack('DeleteCategory', '');
}
}
</script>
</HEAD>
<body>
<form ID="Forums" method="post" runat="server">
<Forums:Header Runat="server" ID="Header" />
<!-- hidden server controls for handling the events on the server -->
<input type="hidden" ID="paramID" runat="server">
<asp:LinkButton ID="DeleteCategory" runat="server" OnClick="DeleteCategory_Click" Visible="False" />
<asp:LinkButton ID="DeleteForum" runat="server" OnClick="DeleteForum_Click" Visible="False" />
<br>
<asp:Table runat="server" ID="CategoryBox" Visible="False" Width="500px" HorizontalAlign="Center" CssClass="Forums_General">
<asp:TableRow CssClass="Forums_Header">
<asp:TableCell runat="server" ID="CategoryBoxHeader" ColumnSpan="2" />
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="Name:" 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">
* This field is required
</asp:RequiredFieldValidator>
<asp:TextBox ID="CategoryIDCurr" runat="server" Visible="False" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="Image Url:" 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="Position:" 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">
* Invalid format
</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"> Submit ]</asp:LinkButton>
<asp:LinkButton ID="CancelCategory" OnClick="CancelCategory_Click" CausesValidation="False" runat="server">[ <img border="0" src="./Images/Cancel.gif" Alt="Cancel"> Cancel ]</asp:LinkButton>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<asp:Table runat="server" ID="ForumBox" Visible="False" Width="500px" HorizontalAlign="Center" CssClass="Forums_General">
<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="Name:" 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">
* This field is required
</asp:RequiredFieldValidator>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell Text="Description:" 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="Position:" 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">
* Invalid format
</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"> Submit ]</asp:LinkButton>
<asp:LinkButton ID="CancelForum" OnClick="CancelForum_Click" CausesValidation="False" runat="server">[ <img border="0" src="./Images/Cancel.gif" Alt="Cancel"> Cancel ]</asp:LinkButton>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<br>
<asp:DataList ID="CategoriesList" runat="server" DataKeyField="CategoryID" OnEditCommand="CategoriesList_Edit" Width="100%">
<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">Forum</td>
<td class="Forums_Header2" width="60px" align="center">Topics</td>
<td class="Forums_Header2" width="60px" align="center">Posts</td>
<td class="Forums_Header2" width="90px" align="center">Last Post</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 Runat="server" ID="Footer" />
</form>
</body>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -