日期:2014-05-16 浏览次数:20585 次
//form.aspx.cs
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "c=style.backgroundColor;style.backgroundColor='#00A9FF'");
e.Row.Attributes.Add("onmouseout", "style.backgroundColor=c");
e.Row.Attributes.Add("onclick", "javascript:open('" + value + "');");");
}
}
//form.aspx
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
function open(value) {
if (View1.style.visibility == 'visible') {
View1.style.visibility = 'hidden'
}
else {
View1.style.visibility = 'visible';
View1.style.top = event.clientY;
View1.style.left = event.clientX;
$.ajax({
type: "post",
url: "form1.aspx",
data: "id=" + value,
dataType: "text",
success: function (msg) {
$("div#View1").html(msg);
}
});
}
}
</script>