0

你能告诉我如何在 SPGridView 的 NavigateURL 中使用当前项目 ID。下面是代码示例。如果我使用 Eval,它会给出运行时错误。在这种情况下请帮助我..

<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>

提前致谢!

4

1 回答 1

1

使用我的网格中的以下更改解决了它。

<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>
于 2013-08-27T08:06:56.837 回答