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

editable GridViewDynamicHyperlinkColumn

3 Answers 42 Views
GridView
This is a migrated thread and some comments may be shown as answers.
sprucely
Top achievements
Rank 1
sprucely asked on 13 Sep 2011, 11:16 PM
I want users to be able to tab into a cell of a hyperlink column and edit the url when a row is in edit mode. Since the GridViewDynamicHyperlinkColumn is read-only, I thought I could subclass it to provide an edit textbox. But I can't override CanEdit because you've made it internal. Is there a reason for this? I've worked around it by subclassing GridViewBoundColumnBase and reimplementing stuff from the hyperlink column. If you could remove the internal specifier from CanEdit, it would help avoid unnecessary duplication.

3 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 17 Sep 2011, 09:13 AM
Hi Sprucely,

The setter is intentionally not exposed. Here is some general reasoning - If we allow setting this property , we should provide some editing functionality to the column . And for the hyperlink there is not a standard editor - one would like to edit the url , other would like to edit the description etc. Since we can not cover the general case and yet the column is purposed for navigation and not editing we could not allow setting of this property .

For such scenario either your approach (inheriting GridViewBoundColumnBase )  or retemplating the GridViewDataColumn are recommended.

Best wishes,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
sprucely
Top achievements
Rank 1
answered on 19 Sep 2011, 05:14 PM
OK. I can live with my current solution. And if I have time I will look at the retemplating option, as that could help reduce some code.

But I don't quite understand your reasoning. If a developer wants to extend the column to add the ability to edit a url, there is no need for Telerik to implement a standard editor, as it is up to the developer to decide how the url should be edited. Also, it is a virtual method, not a setter, so I don't see how allowing developers to override it could cause any problems. If the subclass overrides CanEdit(...) to return true in some cases, then it is the responsibility of that subclass to provide the edit control.
0
Marc Roussel
Top achievements
Rank 2
answered on 02 Feb 2012, 01:47 PM
Be able to edit a HyperLink is a good idea and I see that I will have to work around that lack.
When the Row is in EditMode, hiting TAB to get to the hyperlink should have an internal implementation to edit the hyperlink as we are in edit mode but clicking it is all right when not editing the row.

Of course as developers we can do it by Templating as Telerik suggests.
Tags
GridView
Asked by
sprucely
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
sprucely
Top achievements
Rank 1
Marc Roussel
Top achievements
Rank 2
Share this question
or