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>

  • 相关阅读:
    zookeeper使用场景
    zookeeper安装配置
    hadoop 远程调试
    deep learning笔记
    Sentiment Analysis(1)-Dependency Tree-based Sentiment Classification using CRFs with Hidden Variables
    PRML阅读笔记 introduction
    Python 学习笔记(2)
    python nltk 学习笔记(5) Learning to Classify Text
    python nltk 学习笔记(4) Writing Structured Programs
    python nltk 学习笔记(3) processing raw text
  • 原文地址:https://www.cnblogs.com/huaze/p/4361223.html
Copyright © 2011-2022 走看看