內容:增加,編輯,刪除,排序,分頁。
<%@ Page Title="" Language="C#" MasterPageFile="~/Mail/MailMasterPage.master" AutoEventWireup="true" CodeBehind="MailContacts.aspx.cs" Inherits="Dftr.Web.Mail.MailContacts" %> <asp:Content ID="Content1" ContentPlaceHolderID="CPH_Center" runat="server"> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:UpdateProgress ID="UpdateProgress1" runat="server"> <ProgressTemplate> <div class="loading"> Loading</div> </ProgressTemplate> </asp:UpdateProgress> <asp:ListView ID="ListView1" runat="server" DataKeyNames="Id" InsertItemPosition="LastItem" ConvertEmptyStringToNull="False" OnItemInserting="ListView1_ItemInserting" OnItemCanceling="ListView1_ItemCanceling" OnItemDeleting="ListView1_ItemDeleting" OnItemEditing="ListView1_ItemEditing" OnItemUpdating="ListView1_ItemUpdating" OnSorting="ListView1_Sorting" OnPagePropertiesChanging="ListView1_PagePropertiesChanging"> <ItemTemplate> <tr style=""> <td> <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' /> </td> <td> <asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' /> </td> <td> <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' /> </td> <td> <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="刪除" /> <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="編輯" /> </td> </tr> </ItemTemplate> <AlternatingItemTemplate> <tr style=""> <td> <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' /> </td> <td> <asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' /> </td> <td> <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' /> </td> <td> <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="刪除" /> <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="編輯" /> </td> </tr> </AlternatingItemTemplate> <EmptyDataTemplate> <table runat="server" style=""> <tr> <td> 未返回數據。 </td> </tr> </table> </EmptyDataTemplate> <InsertItemTemplate> <tr style=""> <td> <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' /> </td> <td> <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' /> </td> <td> <asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>' /> </td> <td> <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="插入" /> <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="清除" /> </td> </tr> </InsertItemTemplate> <LayoutTemplate> <table runat="server" style="width: 100%"> <tr runat="server"> <td runat="server"> <table id="itemPlaceholderContainer" runat="server" border="0" style=""> <tr runat="server" style=""> <th runat="server"> <asp:LinkButton ID="SortName" runat="server" Text="姓名" CommandName="Sort" CommandArgument="Name" /> <asp:Image ID="NameImage" runat="server" Visible="false" /> </th> <th runat="server"> <asp:LinkButton ID="SortEmail" runat="server" Text="Email" CommandName="Sort" CommandArgument="Email" /> <asp:Image ID="EmailImage" runat="server" Visible="false" /> </th> <th runat="server"> <asp:LinkButton ID="SortDescription" runat="server" Text="描述" CommandName="Sort" CommandArgument="Description" /> <asp:Image ID="DescriptionImage" runat="server" Visible="false" /> </th> </tr> <tr id="itemPlaceholder" runat="server"> </tr> </table> </td> </tr> </table> </LayoutTemplate> <EditItemTemplate> <tr style=""> <td> <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' /> </td> <td> <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' /> </td> <td> <asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>' /> </td> <td> <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="更新" /> <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" /> </td> </tr> </EditItemTemplate> <SelectedItemTemplate> <tr style=""> <td> <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' /> </td> <td> <asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' /> </td> <td> <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' /> </td> <td> <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="刪除" /> <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="編輯" /> </td> </tr> </SelectedItemTemplate> </asp:ListView> <asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1"> <Fields> <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" /> <asp:NumericPagerField /> <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" /> </Fields> </asp:DataPager> </ContentTemplate> </asp:UpdatePanel> </asp:Content>
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using Dftr.Mail; using Dftr.Entity.Mail; namespace Dftr.Web.Mail { public partial class MailContacts : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ListViewBind(); } } void ListViewBind() { DataTable dt = BLLMailContacts.GetList("TestName"); DataView dv = dt.DefaultView; if (ViewState["SortColumn"] != null) { dv.Sort = ViewState["SortColumn"].ToString() + " " + ViewState["SortDirection"].ToString(); } ListView1.DataSource = dv; ListView1.DataBind(); } protected void ListView1_ItemInserting(object sender, ListViewInsertEventArgs e) { MailContactsEntity ent = new MailContactsEntity(); ent.Name = (ListView1.InsertItem.FindControl("NameTextBox") as TextBox).Text; ent.Email = (ListView1.InsertItem.FindControl("EmailTextBox") as TextBox).Text; ent.Description = (ListView1.InsertItem.FindControl("DescriptionTextBox") as TextBox).Text; ent.UserName = "TestName"; if (BLLMailContacts.Add(ent) > 0) { ListViewBind(); UpdatePanel1.Update(); } else { e.Cancel = true; } } protected void ListView1_ItemEditing(object sender, ListViewEditEventArgs e) { ListView1.EditIndex = e.NewEditIndex; ListViewBind(); } protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e) { MailContactsEntity ent = new MailContactsEntity(); ent.Id = int.Parse(ListView1.DataKeys[e.ItemIndex].Value.ToString()); ent.Name = (ListView1.Items[e.ItemIndex].FindControl("NameTextBox") as TextBox).Text; ent.Email = (ListView1.Items[e.ItemIndex].FindControl("EmailTextBox") as TextBox).Text; ent.Description = (ListView1.Items[e.ItemIndex].FindControl("DescriptionTextBox") as TextBox).Text; ent.UserName = "TestName"; if (BLLMailContacts.Update(ent) > 0) { ListView1.EditIndex = -1; ListViewBind(); UpdatePanel1.Update(); } else { e.Cancel = true; throw new Exception("未更新"); } } protected void ListView1_ItemCanceling(object sender, ListViewCancelEventArgs e) { ListView1.EditIndex = -1; ListViewBind(); } protected void ListView1_ItemDeleting(object sender, ListViewDeleteEventArgs e) { if (BLLMailContacts.Remove(int.Parse(ListView1.DataKeys[e.ItemIndex].Value.ToString())) > 0) { ListViewBind(); UpdatePanel1.Update(); } else { e.Cancel = true; throw new Exception("未刪除"); } } protected void ListView1_Sorting(object sender, ListViewSortEventArgs e) { //隱藏所有列的圖片 ListView1.FindControl("NameImage").Visible = false; ListView1.FindControl("EmailImage").Visible = false; ListView1.FindControl("DescriptionImage").Visible = false; ViewState["SortColumn"] = e.SortExpression; if (ViewState["SortDirection"] != null) { if (ViewState["SortDirection"].ToString() == "ASC") { ViewState["SortDirection"] = "DESC"; (ListView1.FindControl(ViewState["SortColumn"].ToString() + "Image") as Image).ImageUrl = "~/img/arrow_down.gif"; ListView1.FindControl(ViewState["SortColumn"].ToString() + "Image").Visible = true; } else { ViewState["SortDirection"] = "ASC"; (ListView1.FindControl(ViewState["SortColumn"] .ToString()+ "Image") as Image).ImageUrl = "~/img/arrow_top.gif"; ListView1.FindControl(ViewState["SortColumn"].ToString() + "Image").Visible = true; } } else { ViewState["SortDirection"] = "ASC"; (ListView1.FindControl(ViewState["SortColumn"].ToString() + "Image") as Image).ImageUrl = "~/img/arrow_top.gif"; ListView1.FindControl(ViewState["SortColumn"].ToString() + "Image").Visible = true; } ListViewBind(); UpdatePanel1.Update(); } protected void ListView1_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { DataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); ListViewBind(); UpdatePanel1.Update(); } } }
作者:vivo 互聯網數據庫團隊- Qiu Xinbo 本文主要通過圖示介紹了用主鍵進行分片查詢的過程,介紹了主鍵分頁查詢存在SQL性能問題,如何去創建高效的索引去優化主鍵分頁查詢的SQL性能問題 對於數據分佈不均
上篇從服務粒度角度進行了探討,本文繼續從服務內的分層角度探討。 本文的觀點源自我在學習與實踐過程中的深思熟慮,尚處於不斷探索和驗證的階段。希望能“拋磚引玉”,激發更多的討論與交流。讓我們共同進步,在探討與實證中尋求真知。 一、背景 應用
1.安全之Kerberos安全認證 1 Kerberos概述 1.1 什麼是Kerberos Kerberos是一種計算機網絡授權協議,用來在非安全網絡中,對個人通信以安全的手段進行身份認證。這個詞又指麻省理工學院爲這個協議開發的一套計算
本文介紹了 InnoDB 支持哪幾類表鎖,以及它們分別都用在什麼場景下,還介紹了其中兩類表鎖爲什麼要存在。 作者:操盛春,愛可生技術專家,公衆號『一樹一溪』作者,專注於研究 MySQL 和 OceanBase 源碼。 愛可生開源社區出品,
本文分享自華爲雲社區《手拉手入門springboot+kafka》,作者:QGS。 安裝kafka 啓動Kafka本地環境需Java 8+以上 Kafka是一種高吞吐量的分佈式發佈訂閱消息系統,它可以處理消費者在網站中的所有動作流數據。
作者:胡安祥 滿幫集團,作爲“互聯網+物流”的平臺型企業,一端承接託運人運貨需求,另一端對接貨車司機,提升貨運物流效率。2021 年美股上市,成爲數字貨運平臺上市第一股。根據公司年報,2021 年,超過 350 萬貨車司機在平臺上完成超 1
作者:Seata 社區 Part 1:歡迎大家報名 Apache Seata (incubating) 開源之夏 2024 課題 開源之夏 2024 學生報名期爲 4 月 30 日 - 6 月 3 日,歡迎報名 Apache Seata(i
圖片來源:國家航天局網站 近日,嫦娥六號任務還搭載了多個國際合作項目,包括法國的氡氣探測儀、歐空局(歐洲航天局(英文:European Space Agency),簡稱歐空局或ESA)的負離子探測儀、意大利的激光角反射鏡
轉載自tuoluzhe8521 導讀:通過簡化複雜的任務依賴關係, DolphinScheduler爲數據工程師提供了強大的工作流程管理和調度能力。在3.2.0版本中,DolphinScheduler帶來了一系列新功能和改進,使其在生產環
服務發現 在Spring cloud中,要注意區別服務和服務實例,這是兩個概念,一個微服務單元可以部署多個節點, 每個節點即一個服務實例,Spring cloud默認通過 spring.application.name 配置項來標識一個微服
本文作者: 張顯華、竇智浩、盧進文 與集中式架構相比,分佈式架構的系統複雜性呈指數級增長,混沌工程在信創轉型、分佈式架構轉型、小機下移等過程中有效保障了生產的穩定性。本文分享了 TiDB 分佈式數據庫在銀行核心業務系統落地中進行混沌測試的場
漏洞概述 漏洞服務: uhttpd 漏洞類型: 遠程命令執行 影響範圍: 1.0.4.26之前的NETGEAR R9000設備會受到身份驗證繞過的影響 解決建議: 更新版本 漏洞復現 操作環境: ubuntu:22.04 qemu-ve
本文分享自華爲雲社區《KubeEdge v1.17.0發佈!數據處理能力與易用性全面提升》 ,作者: 雲容器大未來。 KubeEdge社區v1.17.0 版本正式發佈。新版本爲邊緣節點和設備帶來了更多的新能力,同時持續在易用性上
1、下載: https://www.docker.com/products/docker-desktop/ 如果電腦分多個盤,建議下載到可用存儲較大的盤,安裝的時候默認安裝到 C 盤,安裝完成後雙擊啓動 如果出現【Docker
OpenAI 發佈 ChatGPT-4o,意味着人機交互進入新的時代。Chat-GPT4o 是一個跨文本、視覺和音頻端到端訓練的新模型,所有輸入和輸出都由同一個神經網絡處理。這也在告訴所有人,GenAI 連接非結構化數據,非結構化數據之間跨