內容:增加,編輯,刪除,排序,分頁。
<%@ 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(); } } }
本文分享自華爲雲社區《華爲雲短信服務教你用Perl實現Smgp協議》,作者:張儉。 引言&協議概述 中國電信短消息網關協議(SMGP)是中國網通爲實現短信業務而制定的一種通信協議,全稱叫做Short Message Gateway Pro
查詢出來的日期數據比數據庫中日期數據晚8小時,一開始很懵逼,IDEA 和 server 時區都一樣呢!後來發現: jdbcUrl=jdbc:mysql://localhost:hentai?useUnicode=true&character
作者:柳遵飛 Nacos 作爲配置中心經常存儲一些敏感信息,但是由於誤用導致安全風險,最常見的主要是以下兩個問題: 1)Nacos 暴露公網可以嗎?不可以,因爲 Nacos 定位是註冊配置中心,是內部系統,不應該暴露到公網使用。 2)不得已
本文分享自華爲雲社區《對接HiveMetaStore,擁抱開源大數據》,作者:睡覺是大事。 1. 前言 適用版本:9.1.0及以上 在大數據融合分析時代,面對海量的數據以及各種複雜的查詢,性能是我們使用一款數據處理引擎最重要的考量
轉載自第一片心意 1 前言 由於海豚調度器官網的集羣部署文檔寫的較亂,安裝過程中需要跳轉到很多地方進行操作,所以自己總結了一篇可以直接跟着從頭到尾進行操作的文檔,以方便後續的部署、升級、新增節點、減少節點的相關操作。 2. 提前準備 2.
DevExpress Blazor UI組件使用了C#爲Blazor Server和Blazor WebAssembly創建高影響力的用戶體驗,這個UI自建庫提供了一套全面的原生Blazor UI組件(包括Pivot Grid、調度程序、圖
SSE(Server-Sent Events)是一種用於實現服務器主動向客戶端推送數據的技術,也稱爲“事件流”(Event Stream)。它基於 HTTP 協議,利用了其長連接特性,在客戶端與服務器之間建立一條持久化連接,並通過這條連接實
SOFA 六週年,歡迎來玩 本週六 4.20 上海螞蟻集團 S 空間 掃碼免費報名活動,來與 MOSN 社區負責人線下交流~ MOSN 社區歡迎您的加入! MOSN 官網:https://mosn.io/ MOSN Github:http
在網絡通信中,代理服務器是一種重要的網絡中間件,它可以作爲客戶端和服務器之間的中轉站,增強網絡安全性、提高訪問速度、隱藏真實IP地址等。Python作爲一種強大的編程語言,提供了豐富的庫和模塊,使得實現和配置代理服務器變得非常簡單。本文將介
近日,Zabbix和OceanBase成功完成了兼容認證。Zabbix支持OceanBase作爲後臺數據庫存儲配置數據和歷史數據,並且性能更優於MySQL數據庫。 Zabbix簡略系統拓撲圖: Zabbix Server和Zabbix
本文分享自華爲雲社區《6個實例帶你解讀TinyVue 組件庫跨框架技術》,作者: 華爲雲社區精選。 在DTSE Tech Talk 《 手把手教你實現mini版TinyVue組件庫 》的主題直播中,華爲雲前端開發DTSE技術佈道師阿健老師給
TiDB Serverless 上的向量化功能終於開始邀約體驗啦!本文是來自 TiDB 社區用戶對 TiDB Vector 功能初體驗的詳細分享,hey-hoho 介紹了他從申請體驗到實際操作的全過程,包括創建 TiDB Vector 實例
開源項目推薦 k8s-image-swapper k8s-image-swapper 是 Kubernetes 的一個變更 Webhook,它將鏡像下載到自己的鏡像倉庫,並將鏡像指向該新位置。它是 docker pull-through p
輕鬆復現一張AI圖片 現在有一個非常漂亮的AI圖片,你是不是想知道他是怎麼生成的? 今天我會交給大家三種方法,學會了,什麼圖都可以手到擒來了。 需要的軟件 在本教程中,我們將使用AUTOMATIC1111 stable diffusio
@[toc] Spring Security 是一個功能強大且可高度定製的安全框架,它提供了一套完整的解決方案,用於保護基於 Spring 的應用程序。在 Spring Security 中,路徑匹配是權限控制的核心部分,它決定了哪些請求可