日期:2014-05-17 浏览次数:20608 次
DataKeyNames="ID"现在知道用
string id = GridView1.DataKeys[GridView1 .SelectedIndex ].Value.ToString();获取选中的checkbox值。,现在我想实现的是当点击“查看详情”的时候,后台判断checkbox是否被选中,如果选中了,后台将ID记录下来并出现弹出层(层里面的内容想用C#实现),通过id从数据库中提取数据出现在弹出层里。弹出层的代码:
<script type="text/javascript">
function showid(idname) {
var isIE = (document.all) ? true : false;
var isIE6 = isIE && ([/MSIE (\d)\.0/i.exec(navigator.userAgent)][0][1] == 6);
var newbox = document.getElementById(idname);
newbox.style.zIndex = "9999";
newbox.style.display = "block"
newbox.style.position = !isIE6 ? "fixed" : "absolute";
newbox.style.top = newbox.style.left = "50%";
newbox.style.marginTop = -newbox.offsetHeight / 2 + "px";
newbox.style.marginLeft = -newbox.offsetWidth / 2 + "px";
var layer = document.createElement("div");
layer.id = "layer";
layer.style.width = layer.style.height = "100%";
layer.style.position = !isIE6 ? "fixed" : "absolute";
layer.style.top = layer.style.left = 0;
layer.style.backgroundColor = "#000";
layer.style.zIndex = "9998";
layer.style.opacity = "0.6";
document.body.appendChild(layer);