各位大虾,在RowDataBound里写代码可以实现给Gridview某一列加上超链接,但是怎样使Gridview的某一行的部分列变成超链接呢?请高手指点迷津。
解决方案 »
- 操作数据库提示"无可用源",大家帮忙看看
- C#的POST超时
- winform关于控件数组的问题
- visual studio team foundation server 怎么理解这个东西
- 小提三问(来者有分,虽然穷):每页HTML最前面2行的语句是什么意思啊?????????
- 请教一个 FileStream 检查文件类型的问题,谢谢!
- 有类似:MyDay = Day("October 19, 1962")提取年月日时分的C#系统自带的代码吗?
- 求助(急)
- 树的checkbox
- 中文版和英文版的win2k哪个用着爽啊?有理的都给分
- 该字符串未被识别为有效地DateTime。。。
- asp.net c# imagemap 在不同热点鼠标显示不同的形状
根据条件判断:
e.Row.Cells[0].Text="<a href=''>xxx</a>"
hyperlink
根据rowindex 设置e.Row.Cells[0].Text
for (int i=1;i<Gridview.Columns.Count;i++)
{
Gridview.Rows[1].Cells[i].Text="<a href=''>"+Gridview.Rows[1].Cells[i].text+"</a>";
}
来实现,但是没成功。
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
e.Row.Cells[i].Text = "<a href=''>" + e.Row.Cells[i].Text + "</a>";
}
}
{
if (e.Row.RowType == DataControlRowType.DataRow)
{ e.Row.Attributes.Add("onclick", "window.location.href='Default.aspx'");
e.Row.Attributes.Add("style", " text-decoration:underline;color:Blue; cursor:pointer;");
}
}
{
}
若GridView1的行数为n,则:
if (e.Row.RowType == DataControlRowType.DataRow)
{
if(e.Row.RowIndex==n-1)
{
e.Row.Attributes.Add("onclick", "window.location.href='Default.aspx'");
e.Row.Attributes.Add("style", " text-decoration:underline;color:Blue;
cursor:pointer;");
}
}