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

GridHyperLinkColumn does not display when binding to IEnumberable?

1 Answer 169 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Billy
Top achievements
Rank 1
Billy asked on 21 Apr 2014, 02:15 PM
1.if (!Page.IsPostBack)
2.{
3.    DataTable table = agenda.GetMeetings(DateTime.Now.AddDays(-30), DateTime.Now.AddDays(30));
4.    var meetings = table.AsEnumerable().OrderByDescending(m => m.Field<DateTime>("StartTime"));
5. 
6.    RadGrid1.DataSource = meetings;
7.    RadGrid1.DataBind();
8.}

Above is the databinding code.

Here is the GridHyperLinkColumn:

1.<telerik:GridHyperLinkColumn Text="View Agenda" HeaderText="" DataNavigateUrlFields="MeetingID"
2.    DataNavigateUrlFormatString="~/Routing/ViewAgenda.aspx?MeetingID={0}">
3.</telerik:GridHyperLinkColumn>

The column does not populate the DataNavigateURLFields property if the table is bound after the AsEnumberable conversion. If binding directly to the DataTable type, the hyperlink will work.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 24 Apr 2014, 07:11 AM
Hello Billy,

In order to resolve the issue, please call AsDataView() to the ordered meetings collection.

In addition, please note that using DataBind() is not recommended. Performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:
Declarative DataSource
Advanced Data Binding


I have created a sample RadGrid web site to demonstrate that the suggested approach works as expected. Please run the attached application and let me know about the result.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Billy
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or