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

GridHyperLinkColumn DataNavigateUrlFormatString

1 Answer 288 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brandon
Top achievements
Rank 1
Brandon asked on 15 Dec 2013, 06:19 PM

I'm working on a small project for work and I'm using Telerik:RadGrid controls. I'm trying to pass a query string with the DO name in the GridHyperLinkColumn. When the page renders and I hover over the link the query string is null (ie: GMRanking.aspx?DO=). It seems like a binding issue but I'm at a loss. Thanks in advance for your help.

I'm populating the grid like so:

    var contestResults = ContestBiz.GetGMData();

    GMGrid.DataSource = contestResults.Select(x => x.DoName).Distinct();

    GMGrid.DataBind();

Here's what I've got in the aspx

            <Columns>               
                <telerik:GridHyperLinkColumn 
                    Text="Select"
                    HeaderStyle-Width="50px" 
                    UniqueName="Link" 
                    DataNavigateUrlFields="DO"
                    DataNavigateUrlFormatString="~/GMRanking.aspx?DO={0}">
                </telerik:GridHyperLinkColumn>

                <telerik:GridBoundColumn DataField="DO" 
                    HeaderText="DO" UniqueName="DO" >
                    <HeaderStyle HorizontalAlign="Left" Font-Bold="true" />
                    <ItemStyle HorizontalAlign="Left" />
                </telerik:GridBoundColumn>                
            </Columns>

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 16 Dec 2013, 06:17 AM
Hello,

I am not able to reproduce this issue.

Please check below code snippet and attached file.

protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
 
    DataTable dt = new DataTable();
 
    dt.Columns.Add("ID", typeof(int));
    dt.Columns.Add("Name", typeof(string));
    dt.Columns.Add("DO", typeof(int));
 
    dt.Rows.Add(1, "name1", 11);
    dt.Rows.Add(2, "name2", 22);
    dt.Rows.Add(3, "name3", 33);
 
    RadGrid1.DataSource = dt;
}
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"
    AllowPaging="true">
    <MasterTableView>
        <Columns>
            <telerik:GridHyperLinkColumn
                Text="Select"
                HeaderStyle-Width="50px"
                UniqueName="Link"
                DataNavigateUrlFields="DO"
                DataNavigateUrlFormatString="~/GMRanking.aspx?DO={0}">
            </telerik:GridHyperLinkColumn>
 
            <telerik:GridBoundColumn DataField="DO"
                HeaderText="DO" UniqueName="DO">
                <HeaderStyle HorizontalAlign="Left" Font-Bold="true" />
                <ItemStyle HorizontalAlign="Left" />
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <PagerStyle AlwaysVisible="true" Position="TopAndBottom" />
</telerik:RadGrid>



Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Brandon
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or