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

GridViewHyperlinkColumn and IsReadOnly

3 Answers 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Konrad Sikorski
Top achievements
Rank 1
Konrad Sikorski asked on 19 Apr 2011, 05:09 PM

Hello again,

I have more less code something like this:

<telerik:RadGridView>
   <telerik:RadGridView.Columns>      
      <telerik:GridViewDataColumn UniqueName="Title" />
      <telerik:GridViewHyperLinkColumn UniqueName="Link" IsReadOnly="True" />
   </telerik:RadGridView.Columns>
</telerik:RadGridView>

So it is a grid with has two columns text and hyperlink. I would like to block editing of hyperlink column. When user is adding or editing row even the IsReadOnly column is set he still is able to modify it. Is it a bug or a feature?

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 19 Apr 2011, 05:43 PM
Hi Konrad,

 

The GridViewHyperlinkColumn/GridViewDynamicHyperlinkColumn columns are not editable. The editable columns are GridViewDataColumn and GridViewComboBoxColumn, you may read more about this here. If you need to achieve some custom functionality you may predefine the CellTemplate/CellEditTemplate of GridViewDataColumn in an appropriate manner.

 

Best wishes,
Vanya Pavlova
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
0
Konrad Sikorski
Top achievements
Rank 1
answered on 20 Apr 2011, 09:29 AM

Thanks for replay.

Probably you are wrong. By default user can edit GridViewHyperlinkColumn. To disable this you have to do some custom implementation. To edit this column user has to be in edit mode and switch to hyperlink column using TAB key. Below are sample code, screenshots.

<telerik:RadGridView x:Name="ucGrid" AutoGenerateColumns="False">
   <telerik:RadGridView.Columns>
       <telerik:GridViewDataColumn UniqueName="Title" />
       <telerik:GridViewHyperlinkColumn UniqueName="Hyperlink" IsReadOnly="True" />
   </telerik:RadGridView.Columns>
</telerik:RadGridView>

public class Entry
{
public string Title { getset; }    public string Hyperlink { getset; } }

public partial class MainPage : UserControl
{
   public MainPage()
   {
      InitializeComponent();
 
      ucGrid.ItemsSource = new ObservableCollection<Entry>
      {
         new Entry{Title = "Title1", Hyperlink="http://web1.com"},
         new Entry{Title = "Title2", Hyperlink="http://web2.com"},
         new Entry{Title = "Title3", Hyperlink="http://web3.com"},
      };
   }
}

0
Vanya Pavlova
Telerik team
answered on 20 Apr 2011, 09:46 AM
Hello Konrad,


Please accept my apology for the omission. We need to some time to investigate why the IsReadOnly property is not working for these column types and how the editing is handled internally. For the time being you may also use the following workaround, through handling the BeginningEdit event of RadGridView as shown below:

private void RadGridView_BeginningEdit(object sender, Telerik.Windows.Controls.GridViewBeginningEditRoutedEventArgs e)
        {
            if (e.Cell.Column is GridViewHyperlinkColumn)
            {
                e.Cancel = true;
            }
  
        }


I have also updated your Telerik points accordingly!


All the best,
Vanya Pavlova
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
GridView
Asked by
Konrad Sikorski
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Konrad Sikorski
Top achievements
Rank 1
Share this question
or