如何在GridView中的HyperLinkField中传递页码?

时间:2021-06-13 09:18:07

I have gridview that I am using paging on. I want to pass along the current page in a asp:Hyperlink so I can send them back to the current page when they are done viewing the details of a record. Is this possible? If it is how can I do this?

我有gridview,我正在使用分页。我想在asp:Hyperlink中传递当前页面,这样我们就可以在查看记录的详细信息时将它们发送回当前页面。这可能吗?如果是这样的话怎么办?

<asp:GridView ID="grdObitList" runat="server" allowpaging="true"
            PageSize="10" AutoGenerateColumns="false" CssClass="grdClass" 
                BorderStyle="None" GridLines="None" CellSpacing="2" >
            <PagerStyle HorizontalAlign="Center" />
            <PagerSettings Position="Bottom" FirstPageText="First" LastPageText="Last" Mode="NumericFirstLast"  />
               <Columns>     
                   <asp:HyperLinkField HeaderText="Name" DataTextField="obit_fullname" DataNavigateUrlFields="obit_id" DataNavigateUrlFormatString="obitDisplay.aspx?oid={0}" />                                     
                   <asp:BoundField ReadOnly="true" HeaderText="Date" DataField="obit_dod" DataFormatString="{0:d/M/yyyy}" />
                   <asp:BoundField ReadOnly="true" HeaderText="Resident Of" DataField="obit_resident" />
                   <asp:BoundField ReadOnly="true" HeaderText="Funeral Home" DataField="obit_funeralhome" />
               </Columns>

1 个解决方案

#1


1  

One way to do it is converting it to a template column, that way you can use normal databind syntaxt to get to it (<%#)

一种方法是将其转换为模板列,这样您就可以使用普通的数据绑定合成器来获取它(<%#)

#1


1  

One way to do it is converting it to a template column, that way you can use normal databind syntaxt to get to it (<%#)

一种方法是将其转换为模板列,这样您就可以使用普通的数据绑定合成器来获取它(<%#)