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

RadGrid: Dynamic DataBound column creation with Hyperlinks

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Noel
Top achievements
Rank 2
Noel asked on 09 May 2010, 03:05 PM
Hi there,

I am using the rad Grid control in one of my applications and it is bound to a datatable. The Datatable is generated via a Stored Procedure containing a Dynamic SQL. In other words the fields returned by the Stored Proc may not have fixed names at every call and I have no control over this.

Having said the above, I would like each cell in the grid to be a hyperlink with a client or server side function. This function should populate a set of textboxes located on the same page as the Grid.

Can someone help me with this?

Thanks

Noel

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 12 May 2010, 12:02 PM
Hi,

If your grid columns will be changing on every postback/rebind, then you should be using programmatic grid definition. You should create your grid entirely in the Page_Init event, so that no ViewState is tracked for the grid. Thus, you will be able to change the columns based on the data fields returned from the database on postback.

As for the links in the column cells, one approach would be to use GridTemplateColumn with a LinkButton in the ItemTemplate. Thus, your link buttons can display data values and perform some action on postback.

Best wishes,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Noel
Top achievements
Rank 2
Answers by
Veli
Telerik team
Share this question
or