想要做这样的功能,点击gridview中的任意行,链接到另外一页
我是这样写的
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string url,href; if (e.Row.RowType == DataControlRowType.DataRow)
{
这里怎么写?
e.Row.Attributes.Add("onclick", href); }
}
不知道中间那段怎么写,这个代码可以实现吗
我是这样写的
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
string url,href; if (e.Row.RowType == DataControlRowType.DataRow)
{
这里怎么写?
e.Row.Attributes.Add("onclick", href); }
}
不知道中间那段怎么写,这个代码可以实现吗
解决方案 »
- [来者有分]第二次发贴,求一个正则表达式的详解。欢迎来讨论
- 求GridView 显示数据库中几个字段的和
- jquery循环输出a标签,a的click失效
- Gridview中的RowCommand问题
- 菜鸟求教 UI层用到业务层的代码都要try catch吗? 发生未处理的异常,如何让页面自动跳转到ErrPage页面呢?
- CreateUserWizardStep.ContentTemplate does not contain an IEditableTextControl
- 【求救!!!】把一个table表保存到execl 中,保存的路径可以选择!!
- 再问一个关于正则表达式的问题
- 如何设置用户控件的事件
- C# 正则匹配div
- 迅雷下载打一个线程会刷新一次
- 关于服务器端Textbox的问题!请指教!
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "window.location.href='webform3.aspx'");
}
}
我想连到 aa.aspx
如果你想连到 aa.aspx,并且需要根据每一行得到不同的查询字符串值,那么需要给gridview创建链接列HypeLinkField,在链接列中设置每一行的查询字符串值