我想具体实现如下功能:
页面上有一个DataGrid
在DataGrid下方有一区域 A 显示详细信息
如何 添加 DataGrid 行 后台 单击事件
点击 DataGrid 一行时触发事件
区域 A 就显示这一行的详细信息 ??
页面上有一个DataGrid
在DataGrid下方有一区域 A 显示详细信息
如何 添加 DataGrid 行 后台 单击事件
点击 DataGrid 一行时触发事件
区域 A 就显示这一行的详细信息 ??
最后一楼~例:在DataGrid1_ItemDataBound事件中加:if(e.Item.ItemType!=ListItemType.Header && e.Item.ItemType!=ListItemType.Footer)
{
string kc="",dj="",jj="";
DataRow r;
DataTable mydb = new DataTable();
mydb = (DataTable)Session["Mytitle"]; //获取详细资料的表,可以做在其他函数中HtmlInputCheckBox CHK = (HtmlInputCheckBox)(e.Item.Cells[0].FindControl("SelectedID"));
string rkid=CHK.Value.Trim(); //这里的复选框包含了表的关键字段
string[] s=new string[1]{rkid};
r=mydb.Rows.Find(s); //根据关键字段查询
kc=r["sl"].ToString();
dj=r["dj"].ToString();
jj=r["jj"].ToString();
e.Item.Attributes.Add("title","库存总量为: "+kc+"\n含税单价为: "+dj+"\n平均单价为: "+jj); //使用title显示详细信息,JS文件会自动将它转为div块...
}