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

How to add IDs to Template in Programmatically Generated RadGrid -VB

1 Answer 9 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Santosh
Top achievements
Rank 1
Santosh asked on 25 Mar 2021, 03:57 PM
Hi

I am trying to replace a Datagrid in a project, I have generated a RadGrid programmatically in the Page_Init as it needs to have a few image links in each row to replicate the functionality that is already in place. The first button is working fine, as it works on a post-back, but im having an issue with replicating the other button, which is a link to a page using an id that is available in one of the other columns.

In the current solution, the below example is how it done on the client side:
DataBinder.Eval(Container, 'DataItem.RecordID', 'ViewRecord.aspx?RecordID={0}')

As im now doing this serverside, how can i replicate the above? My Template currently is using a HyperLink, so I can use the NavigateURL, but im unsure how to get the ID per row and update the template in a programatically generated RadGrid

Any help would be appreciated
Regards
David

1 Answer, 1 is accepted

Sort by
0
Doncho
Telerik team
answered on 30 Mar 2021, 11:28 AM

Hi Santosh,

Please refer to the sample implementation in the Creating Template Columns Programmatically section in our Creating a RadGrid Programmatically documentation article. There you will find a Template with a HyperLink, similar to the scenario in the current case.

For your convenience, I have used the code-snippet to prepare a runnable sample. Please give it a try, and review the code.

I hope this will help you achieve the desired. Please let me know if any further questions come up.

Kind regards,
Doncho
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Santosh
Top achievements
Rank 1
Answers by
Doncho
Telerik team
Share this question
or