Question

How to make a group field as hyperlink in SPGridView. I have following code to add grouping for my gridview but it's not a hyperlink.

gridView.AllowGrouping = true;
gridView.EnableViewState = false;
gridView.GroupField = "Product";
gridView.GroupFieldDisplayName = string.Empty;
gridView.AllowGroupCollapse = true;
gridView.DataBind();
Était-ce utile?

La solution

Try using below code in your SPGridView Design, you need to add 'HyperLink' in your <ItemTemplate> as bellow

<asp:TemplateField HeaderText="Product">
<ItemTemplate>
<asp:HyperLink ID="lnkProduct" Text="Product" runat="server" NavigateUrl='<%# String.Format("/SiteUrl/Product.aspx?ID={0}", Eval("ID")) %>' Visible="false" ></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top