GridView的增删改查和分页
GridView的增删改查和分页                <asp:GridView ID="GridView1" runat="server" Width="100%" CellPadding="4" ForeColor="#333333"
                            AutoGenerateColumns="False" AllowPaging="True" PageSize="12" OnRowCancelingEdit="GridView1_RowCancelingEdit"
                            OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" OnRowDeleting="GridView1_RowDeleting"
                            DataKeyNames="id" OnPageIndexChanging="GridView1_PageIndexChanging"  OnRowDataBound="GridView1_RowDataBound" GridLines="None">
                            <Columns>
                                <asp:TemplateField HeaderText="登录名">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("admin") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("admin") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="密码">
                                    <ItemTemplate>
                                        <%# Eval("UserPassword")%>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("UserPassword") %>'></asp:TextBox>&nbsp;
                                    </EditItemTemplate>
                                    <ItemStyle Width="100px" />
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="最后登录时间" DataField="logintime" ReadOnly="True" />
                                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" HeaderText="操作" />
                            </Columns>
                            <PagerSettings FirstPageText="" LastPageText="" NextPageText="" PreviousPageText="" />
                            <RowStyle Height="20px" BackColor="#F7F6F3" ForeColor="#333333" />
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <EditRowStyle BackColor="#999999" />
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        </asp:GridView>

 

 

SqlConnection conn = null;
GridView的增删改查和分页    
string connstr = System.Configuration.ConfigurationManager.AppSettings["Connstring"];//在Config中自己搞,不会的看书
GridView的增删改查和分页
    protected void Page_Load(object sender, EventArgs e)
    }

相关文章:

  • 2021-07-16
  • 2021-11-30
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2021-10-21
  • 2021-07-11
猜你喜欢
  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-01-15
相关资源
相似解决方案