DataList数据的绑定

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="WebApplication1.Index" %> <!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>
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div> <asp:DataList ID="DataList1" runat="server"
onselectedindexchanged="DataList1_SelectedIndexChanged" RepeatColumns="3"
RepeatDirection="Horizontal">
<ItemTemplate>
<table class="style1">
<tr>
<td rowspan="3">
<asp:Image ID="Image1" runat="server" Height="120px"
ImageUrl='<%# Eval("pic") %>' Width="100px" />
</td>
<td>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("price") %>'></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("sprice") %>'></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:ImageButton ID="ImageButton1" runat="server"
CommandArgument='<%# Eval("pid") %>' ImageUrl="~/images/MenuPic/edit.gif"
onclick="ImageButton1_Click" />
<asp:ImageButton ID="ImageButton2" runat="server"
CommandArgument='<%# Eval("pid") %>' ImageUrl="~/images/MenuPic/delete.gif" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList> </div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient; namespace WebApplication1
{
public partial class Index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BingList();
}
} private void BingList()
{
string sql = "select * from product";
DataTable dt = SQLHelper.GetTable(sql);
DataList1.DataSource = dt;
DataList1.DataBind(); } }
}
DataList数据的绑定的更多相关文章
- 我的angularjs源码学习之旅3——脏检测与数据双向绑定
前言 为了后面描述方便,我们将保存模块的对象modules叫做模块缓存.我们跟踪的例子如下 <div ng-app="myApp" ng-controller='myCtrl ...
- Angular数据双向绑定
Angular数据双向绑定 AngularJS诞生于2009年,由Misko Hevery 等人创建,后为Google所收购.是一款优秀的前端JS框架,已经被用于Google的多款产品当中.Angul ...
- EXTJS4.2 控件之Grid 根据数据源某列数据不同绑定不同的控件setEditor
Grid 根据数据源某列数据不同绑定不同的控件,例如:文本框和下拉框 主要代码写在grid的 plugins: [rowEditing],下面这是定义的rowEditing对象,这里面的要定义成 E ...
- AngularJS中数据双向绑定(two-way data-binding)
1.切换工作目录 git checkout step-4 #切换分支,切换到第4步 npm start #启动项目 2.代码 app/index.html Search: <input ng-m ...
- vuejs数据双向绑定原理(get & set)
前端的数据双向绑定指的是view(视图)和model(数据)两者之间的关系:view层是页面上展示给用户看的信息,model层一般是指通过http请求从后台返回的数据.view到model的绑定都是通 ...
- wemall app商城源码Android 获取XML网络数据并绑定到ListView
wemall-mobile是基于WeMall的android app商城,只需要在原商城目录下上传接口文件即可完成服务端的配置,客户端可定制修改.本文分享Android 获取XML网络数据并绑定到Li ...
- 原生js实现数据双向绑定
最近接触了vue,在谈到vue等等的mvvm框架之前,先了解什么是数据双向绑定以及如何利用原生JS实现数据双向绑定 单向数据绑定 指先把模板写好,然后把模板和数据(数据可能来自后台)整合到一起形成HT ...
- vue中数据双向绑定的实现原理
vue中最常见的属v-model这个数据双向绑定了,很好奇它是如何实现的呢?尝试着用原生的JS去实现一下. 首先大致学习了解下Object.defineProperty()这个东东吧! * Objec ...
- jQuery插件:Ajax将Json数据自动绑定到Form表单
jQuery注册方法的两种常用方式: //jQuery静态方法注册 //调用方法$.a1() $.extend({ a1: function () { console.log("a1&quo ...
随机推荐
- redis数据库使用测试
注:java spring data redis内置了几种redis序列化机制.JdkSerializationRedisSerializer最高效.有关序列化更详细的介绍-http://www.my ...
- mtool安装
先安装python pip.一种python包管理工具. 下面这篇文章讲的很详细.亲测可行. https://ruter.github.io/2015/12/03/Update-python/ git ...
- yii2获取登陆的用户名
yii2获取登陆的用户名: yii::$app->user->identity->username; 判断用户名是否登陆 if(Yii::$app->user->isGu ...
- z/os上的tar和gzip(2)
前一篇文章写过了如何合成并压缩大批量文件,这篇文章解释一下如何在拿到压缩文件后如何解压并还原大批量文件. 解压缩的JCL很简单,如下所示,和压缩的JCL类似,只要把参数改成UNPACK,然后设置一 ...
- viewpage图片轮播
package com.exmple.viewpage2; import java.util.ArrayList;import java.util.List;import java.util.Time ...
- Mongodb 笔记09 备份、部署MongoDB
备份 1. 只有在有信心能在紧急情况下完成迅速部署的情况下,备份才是有用的.所以,无论选择了哪种备份技术,一定要对备份及恢复备份的操作进行练习,知道了然于心. 2. 通常情况下,应对副本集的非主节点( ...
- FTP上传类
using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Net;usi ...
- 19、文件上传与下载/JavaMail邮件开发
回顾: 一. 监听器 生命周期监听器 ServletRequestListener HttpSessionListener ServletContextListener 属性监听器 ServletRe ...
- 线程属性pthread_attr_t
转:http://blog.sina.com.cn/s/blog_6dc9e4cf0100xcvk.html1. 线程属性: 使用pthread_attr_t类型表示,我 ...
- hashcode与equals
归纳一下就是hashCode是用于查找使用的,而equals是用于比较两个对象的是否相等的.以下这段话是从别人帖子回复拷贝过来的: .hashcode是用来查找的,如果你学过数据结构就应该知道,在查找 ...