DataGrid edit, modify, delete, page out example

Source: Internet
Author: User
Tags eval modify tostring trim visual studio
datagrid| page

The test table is now set up in the database, with the fields ID, Code, Name, respectively;

Database links here is not specifically written, the database link and operation request I wrote in the AreaInfo.cs, the code will be used, here to declare

<%@ Page language= "C #" codebehind= "Update.aspx.cs" autoeventwireup= "false" inherits= "Client.Page.AreaInfo.Update "%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<title>test</title>
<meta name= "generator" content= "Microsoft Visual Studio. NET 7.1" >
<meta name= "Code_language" content= "C #" >
<meta name= "vs_defaultClientScript" content= "JavaScript" >
<meta name= "vs_targetschema" content= "http://schemas.microsoft.com/intellisense/ie5" >
</HEAD>
<body ms_positioning= "GridLayout" bgcolor= "Ivory" >
<font face= "Arial" size= "3" ></font><font style= "Background-color: #ffffff" face= "Arial" >
</FONT>
<br>
<form runat= "Server" id= "Form1" >
<table id= "Table1" cellspacing= "0" bgcolor= "#6699cc" cellpadding= "1" width= "" border= "1" >
<TR>
<TD><b>test</b>
</TD>
</TR>
<TD>
<asp:datagrid id= "DG1" runat= "server" bordercolor= "green" width= "640" pagesize= "5" allowpaging= "true"
Onpageindexchanged= "Page_grid" borderwidth= "1" cellpadding= "3" autogeneratecolumns= "false"
Showheader= "true" visible= "true" oneditcommand= "People_edit" oncancelcommand= "People_cancel"
Onupdatecommand= "People_update" ondeletecommand= "People_delete" >
Font-size= "9" horizontalalign= "Center"/>
<itemstyle bordercolor= "" backcolor= "#FFFFF0" forecolor= "Black" font-name= "Arial" font-size= "8"
Font-bold= "False" horizontalalign= "Center"/>
<edititemstyle bordercolor= "" backcolor= "#FFFFF0" forecolor= "Black" font-name= "Arial" font-size= "7"
Font-bold= "False" horizontalalign= "Center"/>
<pagerstyle mode= "NumericPages" font-size= "8"/>
<Columns>
<asp:boundcolumn headertext= "id" readonly= "true" datafield= "id"/>
<asp:TemplateColumn>
<HeaderTemplate>
<b> Code </b>
</HeaderTemplate>
<ItemTemplate>
<asp:label text= ' <%# databinder.eval (Container.DataItem, "Code"). ToString (). Trim ()%> ' runat= "server" id= "Label1" name= "Label1"/>
</ItemTemplate>
<EditItemTemplate>
<asp:textbox id= "code" text= ' <%# DataBinder.Eval (Container.DataItem, "code"). ToString (). Trim ()%> ' runat= "server" width= "100%"/>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<HeaderTemplate>
<b> name </b>
</HeaderTemplate>
<ItemTemplate>
<asp:label width= "text=" <%# DataBinder.Eval (Container.DataItem, "Name"). ToString (). Trim ()%> ' runat= "server" id= "Label2" name= "Label2"/>
</ItemTemplate>
<EditItemTemplate>
<asp:textbox id= "



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.