zoukankan      html  css  js  c++  java
  • ObjectDatasourse 的绑定及显示

    LinqDatasourse    SQldatasourse    都是<%# Eval(“ 列名”);%>单向绑定数据;

    objectDatasourse   不同。   <%#Bind(“列名”);%> 这是双向绑定 。

    创建objectdatasourse   ,首先拉进一个objectdatasourse,选择配置数据源,再选择业务对象(就是针对要显示的表,编辑的逻辑关系类,例CarDa其中包括增删改查方法),下一步在定义数据方法  时,选取使用的函数名。

    下面是绑定显示的实现。

            <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" AutoGenerateColumns="False">

                <Columns>

                    <asp:TemplateField>

                        <EditItemTemplate>

                            编号:<asp:TextBox ID="TextBox1" Text='<%#Bind("Code") %>' runat="server"></asp:TextBox>

                            <br />

                            姓名:<asp:TextBox ID="TextBox2" Text='<%#Bind("Name") %>' runat="server"></asp:TextBox>

                            <asp:Button ID="Button1" runat="server" CommandName="Update" Text="修改" />

                        </EditItemTemplate>

                        <ItemTemplate>

                            编号:<asp:Label ID="Label1" runat="server" Text='<%#Bind("Code") %>'></asp:Label>

                            姓名:<asp:Label ID="Label2" runat="server" Text='<%#Bind("Name")%>'></asp:Label>

                            <asp:Button ID="Button1" runat="server" CommandName="delete" Text="编辑" />

                        </ItemTemplate>

                    </asp:TemplateField>

                </Columns>

            </asp:GridView>

  • 相关阅读:
    Docker For Windows | Setting Up Docker On Windows
    10款游戏的设计分析
    游戏中的沉浸(Flow in Games)
    游戏中运用了人工智能、机器学习等智能算法的思考
    虚幻4的智能指针
    linux下查看已安装的软件与卸载
    Centos7.2下安装mysql5.7,使用rpm包安装
    VMware 安装 CentOS7
    并发之痛 Thread,Goroutine,Actor
    Creating and using a blendspace in c++
  • 原文地址:https://www.cnblogs.com/huaze/p/4361223.html
Copyright © 2011-2022 走看看