This is a migrated thread and some comments may be shown as answers.

GridHyperLinkColumn within a GridTemplateColumn

2 Answers 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Clint Leonard
Top achievements
Rank 1
Clint Leonard asked on 03 Jun 2010, 04:36 PM
I have a grid that currently contains a number of <GridHyperLinkColumn>'s in it.

I found that I needed to have a multi-level header, and so I am now wanting to include the <GridHyperLinkColumn>'s inside of the <ItemTemplate> area of  a <GridTemplateColumn>.

It appears that this is not possible and so my question is how to get the same functionality as I had with the <GridHyperLinkColumn> into the <ItemTemplate> of <GridTemplateColumn>?

Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 04 Jun 2010, 07:45 AM
Hello Clint,

You can achieve same functionality by placing HyperLink in ItemTemplate of GridTemplateColumn.

ASPX:
 
    <telerik:GridTemplateColumn DataField="CustomerID" HeaderText="CustomerID" UniqueName="HyperLink"
        <ItemTemplate> 
            <asp:HyperLink ID="HyperLink11" runat="server" Text='<%# Bind("CustomerID") %>' NavigateUrl='<%# "~/Invoice.aspx?id=" + Eval("CustomerID")  %>'>HyperLink</asp:HyperLink> 
        </ItemTemplate> 
    </telerik:GridTemplateColumn> 


-Shinu.
0
Dave
Top achievements
Rank 1
answered on 08 Aug 2014, 05:34 PM
Here's exactly what you need:

 <telerik:GridTemplateColumn DataField="ClientId" HeaderText="<%$ Resources: TextResource, ClientId%>" UniqueName="HyperLinkClientId">
                            <ItemTemplate>
                                <asp:HyperLink ID="HyperlinkClientId" runat="server" DataTextFormatString="{0}" AllowFiltering="true" DataType="System.Int64"
                                    FilterListOptions="VaryByDataType" DataNavigateUrlFields="CounterpartyId"
                                    ItemStyle-HorizontalAlign="Center" ItemStyle-Font-Bold="True" ItemStyle-Font-Underline="True"
                                    NavigateUrl='<%# "~/Counterparty/CounterpartyDealDrillDown.aspx?CounterpartyId=" + Eval("CounterpartyId")%>'
                                    SortExpression="ClientId" DataTextField="ClientId" FilterControlWidth="50px"
                                    Text='<%# Eval("ClientId") %>'>
                                </asp:HyperLink>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadNumericTextBox runat="server" ID="ClientIdRadNumericTextBox" MaxValue="999999999" MaxLength="9" AllowOutOfRangeAutoCorrect="false">
                                    <NumberFormat AllowRounding="false" GroupSeparator="" />
                                </telerik:RadNumericTextBox>
                                <asp:RequiredFieldValidator runat="server" ID="ClientIdRadNumericTextBoxFieldValidator" ControlToValidate="ClientIdRadNumericTextBox" />
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>

Regards from Guatemala!!!!
Tags
Grid
Asked by
Clint Leonard
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Dave
Top achievements
Rank 1
Share this question
or