62,046
社区成员
发帖
与我相关
我的任务
分享
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();
}
function gridRowClick(obj) {
var cb = $(obj).find('input[type=radio]');
cb.get(0).onclick();
}
e.Row.Attributes.Add("onClick", "gridRowClick(this)");
后台调用这个方法,此方法中执行radio的操作
<tr onmouseover="c=this.style.backgroundColor;this.style.backgroundColor='#8EC26F'" onmouseout="this.style.backgroundColor=c" onClick="getuserInfo('stezhao','123','')" style="Cursor:hand">
<td>
<input type="radio" id="radChange" name="radChange" onclick="getInfo('stezhao','123','True')" />
</td><td>stezhao</td><td>123</td><td>True</td>
</tr>