后台代码:
protected string setToolip(string id)//提示
{
SqlConnection con = Class1.createCon();
con.Open();
string sql = "select * from userinfo where id=" + id;
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataReader sdr = cmd.ExecuteReader();
sdr.Read();
string tooptip = "用户id:" + sdr.GetInt32(0) + " " + "\n用户姓名:" + sdr.GetString(1) + " " + "\n用户密码:" + sdr.GetString(2) + " ";
return tooptip;
}
前台代码:
ToolTip='<%# setToolip(Eval("id").ToString()) %>'