简体   繁体   English

如何在SPGridview中使用当前项目ID

[英]How to use current item id in SPGridview

Can you please tell me how do i use current item id in the NavigateURL in SPGridView. 您能告诉我如何在SPGridView的NavigateURL中使用当前项目ID。 Below is the code sample. 下面是代码示例。 If I use Eval it is giving run time error. 如果我使用Eval,则会出现运行时错误。 Please help me in this case.. 在这种情况下请帮助我。

<SharePoint:SPGridView runat="server" ID="gdvSearchResults" width="50%" AllowSorting="True" 
    AutoGenerateSelectButton="false" AutoGenerateColumns="false"> 
    <Columns>
            <SharePoint:SPBoundField runat="server" DataField="Attachments" HeaderText="Attachments" SortExpression="Attachments" />
            <SharePoint:SPBoundField runat="server" DataField="Practice" HeaderText="Practice" />
            <asp:HyperLinkField DataTextField="ID" HeaderText="Require_x0020_Details_x0020__x00" NavigateUrl="http://server/sites/TestingCollection/TestLists/Send%20Mail/EditForm.aspx?ID="+ID/>        
    </Columns> 
    </SharePoint:SPGridView>

Thanks in advance! 提前致谢!

Resolved it using the below changes in my grid. 使用我的网格中的以下更改解决了该问题。

<SharePoint:SPGridView runat="server" ID="gdvSearchResults" width="50%" AllowSorting="True" 
AutoGenerateSelectButton="false" AutoGenerateColumns="false"> 
<Columns>
        <SharePoint:SPBoundField runat="server" DataField="Attachments" HeaderText="Attachments" SortExpression="Attachments" />
        <SharePoint:SPBoundField runat="server" DataField="Practice" HeaderText="Practice" />
        <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="~/EditForm.aspx?ID={0}" DataTextField="ID"  HeaderText="ID" />
</Columns> 
</SharePoint:SPGridView>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM