62,047
社区成员
发帖
与我相关
我的任务
分享
<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="UserInfo.aspx.cs" Inherits="JiaoYou_Admin_AdminInfo" %>
<!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>
</head>
<body>
<form id="form1" runat="server">
<asp:DataList ID="DataList1" runat="server"
OnDeleteCommand="DataList1_DeleteCommand" DataKeyField="UserName"
OnUpdateCommand="DataList1_UpdateCommand"
BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black"
Height="188px" Width="499px" Font-Size="Smaller">
<HeaderTemplate>
<table border="1" align="center" width="100%">
<tr style=" width:100%" align="center" style="color:#999">
<td style="margin-left:10px;">会员名</td>
<td style=" margin-left:10px;">账户名</td>
<td style=" margin-left:10px;">性别</td>
<td style=" margin-left:10px;">出生日期</td>
<td style=" margin-left:10px;">婚姻状态</td>
<td style=" margin-left:10px;">删除</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style=" color:#999" >
<td style="margin-left:10px;"> <%# DataBinder.Eval(Container.DataItem, "NickName")%></td>
<td style="margin-left:10px;"><%#DataBinder.Eval(Container.DataItem, "UserName")%></td>
<td style="margin-left:10px;"><%#DataBinder.Eval(Container.DataItem, "Sex")%></td>
<td style="margin-left:10px;"><%#DataBinder.Eval(Container.DataItem, "BirthDay")%></td>
<td style="margin-left:10px;"><asp:Button ID="Mod" runat ="server" Text ="编辑" CommandName ="Update"/></td>
<td style="margin-left:10px;"><asp:Button ID="Del" runat ="server" Text ="删除" CommandName= "Delete"/></td>
</tr>
</ItemTemplate>
<FooterTemplate></table></FooterTemplate>
<FooterStyle />
<SelectedItemStyle />
<AlternatingItemStyle />
<HeaderStyle Font-Bold="True" />
</asp:DataList>
<br />
</form>
</body>
</html>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class JiaoYou_Admin_AdminInfo : System.Web.UI.Page
{
UserInfo user = new UserInfo();
protected void Page_Load(object sender, EventArgs e)
{
DataSet ds = user.select();
DataList1.DataSource = ds;
DataList1.DataBind();
}
protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)
{
string username = this.DataList1.DataKeyField[e.Item.ItemIndex].ToString();
DataSet ds = user.select_username(username);
DataList1.DataSource = ds;
DataList1.DataBind();
}
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "Bianji")
{
TextBox1.Text = "123123";
}
}
protected void DataList1_DeleteCommand(object source, DataListCommandEventArgs e)
{
}
}
protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)
{
TextBox1.Text = "123123";
}
就是刷新当前页面 ,无反应啊!