先说明效果:
当鼠标在GridView的行上划过的时候,页面显示出相应行的内,但是项的内容是非数字的时候,不能显示
代码如下:[code=C#]
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string res = e.Row.Cells[0].Text.ToString();
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标加载的时候,在页面下方显示详细信息
e.Row.Attributes.Add("onmouseover", "document.getElementById(\"newsInfo\").innerHTML=" + res + "");
//在客户端动态的显示内容
}
}[code]
当鼠标在GridView的行上划过的时候,页面显示出相应行的内,但是项的内容是非数字的时候,不能显示
代码如下:[code=C#]
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string res = e.Row.Cells[0].Text.ToString();
if (e.Row.RowType == DataControlRowType.DataRow)
{
//当鼠标加载的时候,在页面下方显示详细信息
e.Row.Attributes.Add("onmouseover", "document.getElementById(\"newsInfo\").innerHTML=" + res + "");
//在客户端动态的显示内容
}
}[code]
解决方案 »
- LINQ TO SQL中的where id in(1,2,3,4,5)如何实现
- 老问题 关于GridView+存储过程分页的那点事
- 未能加载视图状态
- gridview中点击行任意点,都选中该行,该怎么写代码?
- 还是ASP转ASP.net的问题!判高人指点!100高分请教
- 新手:帮忙看看这段代码错在哪?
- internalsubstringwithchecks length cannot be less than zero错误
- 高手,麻烦告诉我如何在DATAGRID里添加新行,最好有原码
- 关于下载的问题
- 本机测试一切正常,传到服务器上浏览提示我AjaxPro未定义,为什么?
- updatepanel里弹出对话框报错
- 求高手帮忙调试代码
e.Row.Attributes.Add("onmouseover", "document.getElementById(\"newsInfo\").innerHTML='" + res + "';");
改成
string res = "'" + e.Row.Cells[0].Text.ToString() + "'"
e.Row.Attributes.Add("onmouseover", "document.getElementById(\"newsInfo\").innerHTML='" + res + "';");
当然用\"也可以:
e.Row.Attributes.Add("onmouseover", "document.getElementById(\"newsInfo\").innerHTML=\"" + res + "\";");
阿非(想找回编程的感觉~)
你的代码我贴上运行了,报错所以……,不过还是谢谢你