程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> ASP.NET >> 關於ASP.NET >> ASP.NET GridView學習之五 單行編輯

ASP.NET GridView學習之五 單行編輯

編輯:關於ASP.NET

GridViewEdit.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GridViewEditTest.aspx.cs" Inherits="GridViewEditTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
  <title>無標題頁</title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
    <asp:Panel ID="pnlEdit" runat="server" Height="50px" Width="684px" Visible="False">
      姓名:<asp:TextBox ID="txtUserName" runat="server"></asp:TextBox>地址:<asp:TextBox ID="txtAddress" 

runat="server"></asp:TextBox>郵編<asp:TextBox ID="txtPostCode" runat="server"></asp:TextBox><asp:Button ID="btnOK" 

runat="server" Text="確定" OnClick="btnOK_Click" />
      <asp:Button ID="btnCancel" runat="server" Text="取消" OnClick="btnCancel_Click" /></asp:Panel>
    <br />
    <br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
      BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyNames="CLientID"
      GridLines="Horizontal" OnPageIndexChanging="GridView1_PageIndexChanging" OnSelectedIndexChanging="GridView1_SelectedIndexChanging" 

AllowPaging="True">
      <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
      <Columns>
        <asp:CommandField ShowSelectButton="True" />
        <asp:BoundField DataField="ClientName" HeaderText="姓名" SortExpression="ClientName" />
        <asp:BoundField DataField="AddressStr" HeaderText="地址" SortExpression="AddressStr" />
        <asp:BoundField DataField="PostCode" HeaderText="郵編" SortExpression="PostCode" />
      </Columns>
      <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
      <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
      <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
      <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
      <AlternatingRowStyle BackColor="#F7F7F7" />
    </asp:GridView>
  </div>
  </form>
</body>
</html>

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved