重定向到特定页面被点击的GridView ButtonField字段时 [英] Redirect to specific page when a gridview buttonfield is clicked

查看:130
本文介绍了重定向到特定页面被点击的GridView ButtonField字段时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的GridView的两个领域。一个是与一个时间范围的场,其中之一是一ButtonField字段。我想要让这个当单击按钮时,它会重定向到一个特定的页面类似于它是如何当一个HyperLinkField字段被点击这样做了格式化字符串:

I have two fields in my gridview. One is a field with a date range and one of them is a buttonfield. I want to make it so that when a button is clicked, it will redirect them to a specific page with a formatted string similar to how it's done when a hyperlinkfield is clicked as such:

DataNavigateUrlFormatString =ProductInfo.aspx?的ProductID = {0}

不过,我并不想使用其他字段的值(日期范围)。我想用这是SundayOfWeek记录的主键。用户想要一个按钮,而不是超链接。有没有一种方法可以让我做同样的事情用一个按钮?

However, I don't want to use the other field's value(the date range). I want to use the primary key of the record which is "SundayOfWeek". The user wants a button rather than a hyperlink. Is there a way I can do the same thing with a button?

推荐答案

尝试使用这种类型的列,而不是一个ButtonField字段的:

Try using this type of column instead of a ButtonField:

<Columns>
   <asp:HyperLinkField 
     DataTextField="ProductName" 
     HeaderText="Product Name" 
     SortExpression="ProductName" 
     DataNavigateUrlFields="ProductID" 
     DataNavigateUrlFormatString="ProductInfo.aspx?ProductID={0}" />
</Columns>

这篇关于重定向到特定页面被点击的GridView ButtonField字段时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆