ListView Custom Button Instance-Tag Delete feature

Source: Internet
Author: User

The. aspx code is as follows:

<%@ page language= "C #" autoeventwireup= "true" codefile= "Test.aspx.cs" inherits= "test"%><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<span style= "color: #ff0000;" >selectcommand= "SELECT * from [t_series] WHERE se_delete=false ORDER by Se_order DESC" to modify this statement, indicate that the Se_ Delete the item that is marked False. </span>
<span style= "color: #ff0000;" > commandargument= ' <% #Eval ("se_id")%> ' for parameter delivery </span>
The. Aspx.cs code is as follows:

Using system;using system.collections.generic;using system.linq;using system.web;using System.Web.UI;using System.web.ui.webcontrols;using System.data.oledb;public Partial class test:system.web.ui.page{string str_cnn = "Pro vider=microsoft.jet.oledb.4.0;    Data source= ";    String str_sourcefile = "Mdb\\ev.mdb";    OleDbConnection CNN;    OleDbCommand cmd;    OleDbDataReader Datar;    String Str_sql;          protected void Page_Load (object sender, EventArgs e) {} protected void myCMD (object sender, CommandEventArgs e) {        String str_conn = str_cnn + MapPath (str_sourcefile);        CNN = new OleDbConnection (Str_conn); Cnn.        Open (); Str_sql = "Update t_series set Se_delete =true where" + "se_id =" +<span style= "color: #ff0000;" > e.commandargument.tostring ();//Receive Parameters!!!        </span> cmd = new OleDbCommand (Str_sql, CNN); Cmd.        ExecuteNonQuery (); Cnn.        Close (); <span style= "color: #ff0000;" >listview1.databind ();//Data Control insidebutton, you need to rebind the data control's data </span&gt after execution;}} 

The effect is as follows:

When clicked OK, this item is marked for deletion.

ListView Custom Button Instance-Tag Delete feature

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.