📄 linki.aspx
字号:
<%@ Page Language="C#" MasterPageFile="~/admin/adminMasterPage.master" AutoEventWireup="true" CodeFile="linki.aspx.cs" Inherits="admin_linki" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<br />
<asp:FormView ID="FormView1" runat="server" DataKeyNames="id" DataSourceID="SqlDataSource1" AllowPaging="True" DefaultMode="Insert" CellPadding="4" ForeColor="#333333" Height="128px" Width="431px">
<EditItemTemplate>
id:
<asp:Label ID="idLabel1" runat="server" Text='<%# Eval("id") %>'></asp:Label><br />
cid:
<asp:TextBox ID="cidTextBox" runat="server" Text='<%# Bind("cid") %>'></asp:TextBox><br />
name:
<asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>'></asp:TextBox><br />
link:
<asp:TextBox ID="linkTextBox" runat="server" Text='<%# Bind("link") %>'></asp:TextBox><br />
show:
<asp:TextBox ID="showTextBox" runat="server" Text='<%# Bind("show") %>'></asp:TextBox><br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="更新"></asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="取消"></asp:LinkButton>
</EditItemTemplate>
<InsertItemTemplate>
选择类别:
<!--<asp:TextBox ID="cidTextBox" runat="server" Text='<%# Bind("cid") %>'></asp:TextBox>-->
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource3"
DataTextField="class" DataValueField="id" SelectedValue='<%# Bind("cid") %>' Width="80px">
</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [id], [class] FROM [class]"></asp:SqlDataSource>
<asp:Button ID="Button3" runat="server" PostBackUrl="~/admin/link.aspx" Text="新建类别"
Width="68px" /><br />
网站名字:
<asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>' Width="261px"></asp:TextBox><br />
网站地址:
<asp:TextBox ID="linkTextBox" runat="server" Text='<%# Bind("link") %>' Width="297px"></asp:TextBox><br />
网站简介:
<asp:TextBox ID="showTextBox" runat="server" Text='<%# Bind("show") %>' Width="317px"></asp:TextBox><br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
Text="插入"></asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="取消"></asp:LinkButton>
</InsertItemTemplate>
<ItemTemplate>
id:
<asp:Label ID="idLabel" runat="server" Text='<%# Eval("id") %>'></asp:Label><br />
cid:
<asp:Label ID="cidLabel" runat="server" Text='<%# Bind("cid") %>'></asp:Label>
<br />
name:
<asp:Label ID="nameLabel" runat="server" Text='<%# Bind("name") %>'></asp:Label><br />
link:
<asp:Label ID="linkLabel" runat="server" Text='<%# Bind("link") %>'></asp:Label><br />
show:
<asp:Label ID="showLabel" runat="server" Text='<%# Bind("show") %>'></asp:Label><br />
<asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
Text="编辑"></asp:LinkButton>
<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
Text="删除"></asp:LinkButton>
<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
Text="新建"></asp:LinkButton>
</ItemTemplate>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [linki] WHERE [id] = @id" InsertCommand="INSERT INTO [linki] ([cid], [name], [link], [show]) VALUES (@cid, @name, @link, @show)"
SelectCommand="SELECT [id], [cid], [name], [link], [show] FROM [linki] ORDER BY [id] DESC"
UpdateCommand="UPDATE [linki] SET [cid] = @cid, [name] = @name, [link] = @link, [show] = @show WHERE [id] = @id">
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="cid" Type="Int32" />
<asp:Parameter Name="name" Type="String" />
<asp:Parameter Name="link" Type="String" />
<asp:Parameter Name="show" Type="String" />
<asp:Parameter Name="id" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="cid" Type="Int32" />
<asp:Parameter Name="name" Type="String" />
<asp:Parameter Name="link" Type="String" />
<asp:Parameter Name="show" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<br />
<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource3" DataTextField="class" DataValueField="id" AutoPostBack="false" >
<asp:ListItem Selected="True">df</asp:ListItem>
<asp:ListItem>df</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [id], [class] FROM [class]"></asp:SqlDataSource>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="显示" />
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="显示全部" /><br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id"
DataSourceID="SqlDataSource2" Height="175px" AllowPaging="True" AllowSorting="True" CellPadding="3" ForeColor="#333333" GridLines="None" PageSize="12" CaptionAlign="Left">
<Columns>
<asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True"
SortExpression="id" />
<asp:BoundField DataField="name" HeaderText="网站名字" SortExpression="name" />
<asp:BoundField DataField="show" HeaderText="网站简介" SortExpression="show" />
<asp:BoundField DataField="link" HeaderText="网站地址" SortExpression="link" />
<asp:BoundField DataField="cid" HeaderText="类编号" SortExpression="cid" />
<asp:HyperLinkField DataNavigateUrlFields="link" HeaderText="访问" Text="访问" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ButtonType="Button" />
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Left" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand = "SELECT [id], [name], [link], [show], [cid] FROM [linki] ORDER BY [id] DESC" DeleteCommand="DELETE FROM [linki] WHERE [id] = @id" InsertCommand="INSERT INTO [linki] ([name], [link], [show], [cid]) VALUES (@name, @link, @show, @cid)" UpdateCommand="UPDATE [linki] SET [name] = @name, [link] = @link, [show] = @show, [cid] = @cid WHERE [id] = @id" >
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList2" Name="cid" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="name" Type="String" />
<asp:Parameter Name="link" Type="String" />
<asp:Parameter Name="show" Type="String" />
<asp:Parameter Name="cid" Type="Int32" />
<asp:Parameter Name="id" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="name" Type="String" />
<asp:Parameter Name="link" Type="String" />
<asp:Parameter Name="show" Type="String" />
<asp:Parameter Name="cid" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>
<br />
<br />
</asp:Content>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -