0

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();
1

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.