System.Web.UI.Page”并不包含“DataItem”的定义

kmiaoer 2007-04-06 12:04:42
aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="edit_admin_datum.aspx.cs" Inherits="admin_admin_edit_admin_datum" %>
<%@ Import Namespace="System.Data"%>


<!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>管理员资料修改-YY3721</title>
<link href="../style/sys_edit_admin.css" rel="stylesheet" type="text/css"/>
</head>
<body bgcolor="#9CC7EF">
<form id="form1" runat="server" action="edit_admin_datum.aspx">


<table width="70%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td height="40" colspan="2"> <span class="add_manage_title"> 修改管理员 <span class="edit_admin_title">

<%# DataBinder.Eval(Container.DataItem, "Admin_name")%>


</span> 资料</span></td>
</tr>
<tr align="center">
<td height="30" style="width: 441px" align="right">帐号:</td>
<td width="474" height="30" colspan="-1" align="left">
<input id="Text1" type="text" value=" <%# DataBinder.Eval(Container.DataItem, "Admin_name")%>" /> </td>
</tr>
<tr align="center">
<td height="30" style="width: 441px" align="right">
密码:</td>
<td height="30" colspan="-1" align="left">
<input id="Text2" type="text" value=" <%# DataBinder.Eval(Container.DataItem, "Admin_name")%>" /> </td>
</tr>
<tr align="center">
<td height="30" style="width: 441px" align="right">权限:</td>
<td height="30" colspan="-1" align="left">
<asp:Label ID="lbl_level" runat="server" Text="Label"></asp:Label> </td>
</tr>
<tr align="center">
<td colspan="2" style="height: 30px" align="center">
<asp:Button ID="Button1" runat="server" Text="提 交" OnClick="Button1_Click" />
<input id="Button2" type="button" value="取 消" /></td>
</tr>



</table>



</form>
</body>
</html>


CS:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class admin_admin_edit_admin_datum : System.Web.UI.Page
{
protected int admin_id;
protected string str_sql;
protected SqlConnection con_id;
protected SqlDataReader sdr_id;
protected SqlCommand cmd_id;
//protected DataSet ds_id;
protected void Page_Load(object sender, EventArgs e)
{


admin_id = Convert.ToInt32(Request.QueryString["Admin_id"]);
admin_id = 1;
if (isNumeric(admin_id.ToString()))
{
str_sql = "select Admin_id,Admin_name,Admin_pwd,Admin_level from admin where admin_id = '" + admin_id + "'";
con_id = new SqlConnection(ConfigurationSettings.AppSettings["Str_sql"]);
con_id.Open();
cmd_id = new SqlCommand(str_sql, con_id);
sdr_id = cmd_id.ExecuteReader();
// lbl_level.Text = sdr_id.GetInt32(3).ToString();
Page.DataBind();
con_id.Close();

}
else
{
Response.Write("<script>alert('无效参数');</script>");

}
}
protected void Button1_Click(object sender, EventArgs e)
{

}
private bool isNumeric(string str) //判断传入的是否数字
{
if (str == null || str.Length == 0)
return false;
System.Text.ASCIIEncoding ascii = new System.Text.ASCIIEncoding();
byte[] bytestr = ascii.GetBytes(str);
foreach (byte c in bytestr)
{
if (c < 48 || c > 57)
{
return false;
}
}
return true;
}
}
...全文
732 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lazyfish 2007-04-06
  • 打赏
  • 举报
回复
没有数据源。
kmiaoer 2007-04-06
  • 打赏
  • 举报
回复
dddddddddddd
kmiaoer 2007-04-06
  • 打赏
  • 举报
回复
怎么才能有数据`!~ 小弟是新人。。请多多指教

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧