在C#中,我怎么可以参考基于的点击在GridView排按钮,一个特定的产品记录 [英] In C#, how can I reference a specific product record based on a button that's clicked in a gridview row

查看:172
本文介绍了在C#中,我怎么可以参考基于的点击在GridView排按钮,一个特定的产品记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示产品的GridView的页面。这个表里面是一个叫做超链接列详细信息。我想使它这样,如果用户点击该特定产品的细节细胞,一个新的页面将会打开,让在该产品的更多信息。我不知道我会如何确定哪些产品记录详情链接是,我怎么会在那进行到下一个页面。

I have a page that displays a gridview of products. Inside this table is a column with a hyperlink called "Details." I want to make it so that if the user clicks the details cell for that specific product, a new page will open that gives more information on that product. I'm not sure how I would determine which Product record the details link is in and how I would carry that over to the next page.

推荐答案

您使用它使用的产品的ID在查询字符串一个HyperLinkField字段。

You use a HyperlinkField which uses the ID of the product in the querystring.

下面是一个例子:

<asp:GridView runat="server" ID="gridViewProducts">
  <Columns>
     <asp:HyperLinkField HeaderText="ProductId" DataNavigateUrlFormatString="ProductDetail.aspx?action=edit&id={0}" DataNavigateUrlFields="ProductId" DataTextField="ProductId"  />
     <asp:BoundField HeaderText="Product Name" DataField="ProductName" />
  </Columns>
</asp:GridView>

当你绑定,产品ID自动进入查询字符串

When you bind, the productID automatically goes into the querystring

这篇关于在C#中,我怎么可以参考基于的点击在GridView排按钮,一个特定的产品记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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