📄 adminedit_1.aspx
字号:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AdminEdit_1.aspx.cs" Inherits="AdminEdit" %>
<!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>
<form id="form1" runat="server">
<div>
<div style="text-align: center">
<table style="width: 760px">
<tr>
<td align="left" style="width: 100px" valign="top">
<table style="width: 760px">
<tr>
<td style="width: 670px">
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/AdminPage.aspx">返回</asp:HyperLink>
<asp:Label ID="Label1" runat="server" Font-Bold="True" Text="->新闻管理"></asp:Label></td>
</tr>
<tr>
<td align="left" style="width: 100px" valign="top">
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
CellPadding="4" DataKeyNames="NewsID" DataSourceID="SqlDataSource1" EmptyDataText="没有可显示的数据记录。"
ForeColor="#333333" GridLines="None" Width="755px">
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:CommandField ShowDeleteButton="True">
<ItemStyle Font-Size="Smaller" Width="30px" />
</asp:CommandField>
<asp:BoundField DataField="NewsID" HeaderText="编号" ReadOnly="True" SortExpression="NewsID">
<ItemStyle HorizontalAlign="Center" Width="35px" />
<HeaderStyle Font-Size="Smaller" />
</asp:BoundField>
<asp:BoundField DataField="Title" HeaderText="标题" SortExpression="Title">
<ItemStyle Width="135px" />
<HeaderStyle Font-Size="Smaller" />
</asp:BoundField>
<asp:TemplateField HeaderText="内容" SortExpression="Content">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Content") %>'></asp:TextBox>
</EditItemTemplate>
<ItemStyle Width="395px" Wrap="True" />
<HeaderStyle Font-Size="Smaller" />
<ItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Content") %>' TextMode="MultiLine"
Width="400px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Time" DataFormatString="{0:d}" HeaderText="发布时间" ReadOnly="True"
SortExpression="Time">
<ItemStyle Font-Size="Smaller" HorizontalAlign="Right" Width="100px" />
<HeaderStyle Font-Size="Smaller" />
</asp:BoundField>
</Columns>
<RowStyle BackColor="#E3EAEB" />
<EditRowStyle BackColor="#7C6F57" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ACMConnectionString %>"
DeleteCommand="DELETE FROM [News] WHERE [NewsID] = @NewsID" InsertCommand="INSERT INTO [News] ([Title], [Content], [Time]) VALUES (@Title, @Content, @Time)"
ProviderName="<%$ ConnectionStrings:ACMConnectionString.ProviderName %>" SelectCommand="SELECT [NewsID], [Title], [Content], [Time] FROM [News] ORDER BY [NewsID] DESC, [Time] DESC"
UpdateCommand="UPDATE [News] SET [Title] = @Title, [Content] = @Content, [Time] = @Time WHERE [NewsID] = @NewsID">
<DeleteParameters>
<asp:Parameter Name="NewsID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Content" Type="String" />
<asp:Parameter Name="Time" Type="DateTime" />
<asp:Parameter Name="NewsID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Content" Type="String" />
<asp:Parameter Name="Time" Type="DateTime" />
</InsertParameters>
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td style="width: 100px" valign="top">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="发布新闻" /><br />
<asp:Panel ID="Panel1" runat="server" Visible="False" Width="650px">
<asp:Label ID="Label2" runat="server" Text="标题:"></asp:Label><br />
<asp:TextBox ID="titleBox" runat="server" Width="350px"></asp:TextBox><br />
<asp:Label ID="Label3" runat="server" Text="内容:"></asp:Label><br />
<asp:TextBox ID="contentBox" runat="server" Height="150px" TextMode="MultiLine" Width="500px"></asp:TextBox><br />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="提交" /></asp:Panel>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -