gridview行点击事件提示缺少对象
现在的想法是当在某页点击按钮时,弹出新页面,在新页面中点击gridview中的一行。将这一行数据返回到父页面中。我在gridview加了一个checkbox的列。现在点击checkbox已经可以实现了,但是当点击gridview的行时,提示缺少对象。代码:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string username = ((System.Data.DataRowView)(e.Row.DataItem)).Row["Fusername"] as string;
string userpassword = ((System.Data.DataRowView)(e.Row.DataItem)).Row["Fuserpassword"] as string;
string userflag = ((System.Data.DataRowView)(e.Row.DataItem)).Row["fuserflag"] as string;
e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#8EC26F'");
//当鼠标移开时还原背景色
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
//设置悬浮鼠标指针形状为"小手"
e.Row.Attributes["style"] = "Cursor:hand";
e.Row.Attributes.Add("onClick", "getuserInfo('" + username + "','" + userpassword + "','" + userflag + "')");
//e.Row.Attributes.Add("onClick", "test()");
}
}
function getInfo(Fusername, Fuserpassword, Fuserflag) {
alert(Fusername);
window.opener.getuserInfo(Fusername, Fuserpassword, Fuserflag);
window.close();
}
...全文
相关推荐
GridView的点击事件
GridView的点击事件 GridView的点击事件 GridView的点击事件
为GridView的行添加鼠标经过、点击事件的小例子
代码如下: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { e.Row.Attributes.Add(“onmouseover”, “c=this.style.backgroundColor;this.style.backgroundColor=’#95B8FF'”); e.Row.Attributes.Add(“onmouseout”, “this.style.backgroundColor=c”); e.Row.Attribute
GridView 行单击与双击事件
GridView 行单击与双击事件,功能:单击选中行 双击打开详细页面 说明:
GridView动态增加行
GridView动态增加行,非常好用。保证出效果
GridView删除行提示
GridView删除行提示


