コメント
コメントの投稿
※名前とタイトルが入力されていないコメントでは他のコメントとの区別ができません。
入力されていないコメントには返信しませんのであらかじめご了承くださいませ。
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ListViewTest.aspx.vb" Inherits="ListViewTextChanged.ListViewTest" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>ListViewSample</title>
<link rel="stylesheet" type="text/css" href="~/Scripts/Style.css" media="all" />
</head>
<body>
<form id="form1" runat="server">
<div class="table-area">
<asp:ListView ID="ListView1" runat="server" GroupPlaceholderID="groupPlaceHolder1" ItemPlaceholderID="itemPlaceHolder1">
<EmptyDataTemplate>
<table>
<tr>
<th runat="server" class="id-field">
<label>ID</label>
</th>
<th runat="server" class="name-field">
<label>名前</label>
</th>
<th runat="server" class="age-field">
<label>年齢</label>
</th>
<th runat="server" class="result-field">
<label>判定</label>
</th>
</tr>
</table>
<p class="error-text">
データが存在しません。
</p>
</EmptyDataTemplate>
<LayoutTemplate>
<div class="header-area">
<table>
<tr>
<th runat="server" class="id-field">
<label>ID</label>
</th>
<th runat="server" class="name-field">
<label>名前</label>
</th>
<th runat="server" class="age-field">
<label>年齢</label>
</th>
<th runat="server" class="result-field">
<label>判定</label>
</th>
</tr>
<asp:PlaceHolder runat="server" ID="groupPlaceHolder1"></asp:PlaceHolder>
</table>
</div>
</LayoutTemplate>
<GroupTemplate>
<div class="data-area">
<tr>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder1"></asp:PlaceHolder>
</tr>
</div>
</GroupTemplate>
<ItemTemplate>
<tr runat="server">
<td runat="server" class="id-field">
<asp:Label ID="lblID" runat="server" Text='<%# (Eval("ID")) %>'></asp:Label>
</td>
<td runat="server" class="name-field">
<asp:Label ID="lblName" runat="server" Text='<%# (Eval("NAME")) %>'></asp:Label>
</td>
<td runat="server" class="age-field">
<asp:TextBox ID="txtAge" runat="server" AutoPostBack="True" OnTextChanged="txtAge_TextChanged"></asp:TextBox>
</td>
<td runat="server" class="result-field">
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
</div>
</form>
</body>
</html>
Public Class ListViewTest
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dbUtil As New DbUtility()
Dim ds As DataSet = Nothing
Dim sql As New StringBuilder
sql.AppendLine(" SELECT ID ")
sql.AppendLine(" ,Convert(varchar, DecryptByPassPhrase('password', [NAME])) AS NAME ")
sql.AppendLine(" ,AGE ")
sql.AppendLine(" FROM T_Customer ")
sql.AppendLine(" WHERE ID <= 0 ") 'データが0件になるような条件
dbUtil.Connect()
dbUtil.ClearParams()
ds = dbUtil.ExecuteFill(sql.ToString, "CUSTOMER")
Me.ListView1.DataSource = ds
Me.ListView1.DataBind()
End Sub
End Class
※名前とタイトルが入力されていないコメントでは他のコメントとの区別ができません。
入力されていないコメントには返信しませんのであらかじめご了承くださいませ。