Control Delete button, click Delete Message

Source: Internet
Author: User

Front Code:

<!--Category Information -<DivID= "Newnews"class= "Frm">    <h4>Category Management</h4>    <Table>        <TR>            <th>News number</th>            <th>Category name</th>        </TR>        <Asp:repeaterID= "Rep_content"runat= "Server">            <ItemTemplate>                <TR>                    <TDclass= "Number"><%#Eval("ID")%></TD>                    <TD><ahref="#"><%#Eval("Name")%></a></TD>                    <TD><Asp:linkbuttonID= "LinkButton1"runat= "Server"CommandArgument= ' <% #Eval ("ID")%>' Onclientclick= ' return confirm (' OK to delete? ') ' OnClick = "LinkButton1_Click" > Delete</Asp:linkbutton></TD>                </TR>            </ItemTemplate>        </Asp:repeater>    </Table></Div>

Background code:

/// <summary>///Delete Category/// </summary>/// <param name= "Sender" ></param>/// <param name= "E" ></param>protected voidLinkButton1_Click (Objectsender, EventArgs e) {    if(true)    {                    }    //instantiating an action classBll. CATEGORYBLL CBLL =NewCATEGORYBLL (); //get the category ID that you clicked    stringResumeid =((( LinkButton) sender).    Commandargument.tostring ()); //Delete Category    BOOLi =CBLL.    Deletecategoryandcomment (Resumeid); //determine whether to delete    if(i) {Response.Write ("<script>alert (' Delete succeeded! ') </script>"); //rebind Databindcategory (); }    Else{Response.Write ("<script>alert (' Delete failed! ') </script>"); }}

Final effect:

Tip whether to delete, write in the front-end code:


Delete Success! Control Delete button, click Delete Message

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: 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.