栏目导航
热点推荐
- 流行的70个AJAX演示及下载
- 20个Ajax关键议题
- AJAX技术在PHP开发中的简单应用
- 如何选择使用AJAX的最佳时机
- 一日精通Ajax技术
- [四天学会ajax] 学习Ajax教程第
- [四天学会ajax] 学习Ajax教程第
- ajax的server部分(php版)
- 在Ajax 应用程序中实现数据之间
- 解决AJAX 跨域访问完整解决方案
- Ajax获取页面被缓存的解决方案
- ajax检测用户名
阅览排行
Ajax实现DataGrid/DataList动态ToolTip
www.jz123.cn 2008-09-21 来源: 中国建站 袁袁整理 我要投递新闻
1.建立一aspx页面,html代码2.cs代码
using System.Data.SqlClient;
using System.IO;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindData();
}
if (ID != "")
{
GetDescriptionByID(ID);
}
}
property#region property
private string ID
{
get
{
if (Request["ID"] != null && Request["ID"].ToString() != "")
{
return Request["ID"];
}
else
{
return "";
}
}
}
#endregion
GetDescriptionByID#region GetDescriptionByID
private void GetDescriptionByID(string ID)
{
string connStr = ConfigurationSettings.AppSettings["ConnectionString"];
SqlConnection conn = new SqlConnection(connStr);
string sql = "select * from testimage where userid='" + ID + "'";
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
string s = @"<table cellspacing='0' cellpadding='4' width='300' height='200' border='0' id='GridView1' style='color:#333333;border-collapse:collapse;'>";
if(dr.Read())
{
s += "<tr style='color:#333333;background-color:#FFFBD6;'>";
s += "<td width='50'>名称:</td>";
s += "<td>" + dr["UserName"] + "</td>";
s += "</tr>";
s += "<tr style='color:#333333;background-color:White;'>";
s += "<td scope='col'>描述:</td>";
s += "<td>" + dr["Description"] + "</td>";
s += "</tr>";
}
s += "</table>";
dr.Close();
conn.Close();
this.Response.Write(s);
this.Response.End();
}
#endregion
save image#region save image
protected void Button2_Click(object sender, EventArgs e)
{
Stream ImageStream;
string Path = FileUpload1.PostedFile.FileName;// 文件名称
int Size = FileUpload1.PostedFile.ContentLength; // 文件大小
上一篇:Ajax简单示例之改变下拉框动态生成表格 下一篇:Ajax实现在textbox中输入内容,动态从数据库中模糊查询显示到下拉框中