Make single cell readonly

19 posts, 0 answers
  1. Kristof
    Kristof avatar
    32 posts
    Member since:
    Oct 2006

    Posted 22 May 2007 Link to this post

    Hi,

    the MS DataGridView supports readonly on cell-level. I haven't found the same property on the RadGridView. Is it possible?

    Ben
  2. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 22 May 2007 Link to this post

    Hello Kristof,

    Currently RadGridView does not support readonly mode on the cell level. You can make an entire column readonly by using its ReadOnly property.

    Could you tell us more about the specific scenario you're facing? Do you need a particular cells in a row to be readonly subject to a condition applied to a value in another column of the row?

     
    Best wishes,
    Kiril
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Kristof
    Kristof avatar
    32 posts
    Member since:
    Oct 2006

    Posted 23 May 2007 Link to this post

    Hey Kiril,

    the grid I'm displaying contains data aranged in columns. All columns are readonly, except for one: the value column. Here a user can change the value to his likings. But, it could be that the user doesn't have sufficient rights to change the value in row one, but he does for row two.

    So, some cells in one column could be readonly while others are read/write.

    As said before, the MS DataGridView does support this feature, maybe a good feature for the RadGridView also.
  5. Dimitar Kapitanov
    Admin
    Dimitar Kapitanov avatar
    632 posts

    Posted 24 May 2007 Link to this post

    Hi Kristof,
    We have this feature on our ToDo list and will implement it ASAP.
    Thank you for the valuable suggestion.

    Kind regards,
    Dimitar Kapitanov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Oct 2007 Link to this post

    Hi Kristof,

    Here is a forum link that discusses a similar issue. Check it out and let me know whether it helps.

    http://www.telerik.com/community/forums/thread/b311D-hdeta.aspx

    Princy.
  7. Phil
    Phil avatar
    9 posts
    Member since:
    Sep 2012

    Posted 15 Mar 2009 Link to this post

    This is approaching two years, was this ever implemented?

    Thanks
  8. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 16 Mar 2009 Link to this post

    Hi Phil,

    Thank you for the question.

    You can make some cell read only when processing the CellBeginEdit event:

    void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e) 
        if ((int)this.radGridView1.CurrentRow.Cells[2].Value < 10) 
        { 
            e.Cancel = true
        } 

    I hope this helps. Should you have any questions, don't hesitate to contact us.

    Best wishes,
    Jack
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  9. Matt
    Matt avatar
    15 posts
    Member since:
    Jan 2009

    Posted 23 Mar 2010 Link to this post

    I see this question was posted back in 2007.  Does the grdiview allow row-level read-only settings yet?
  10. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 24 Mar 2010 Link to this post

    Hello Matt,

    We decided that the current RadGridView API is enough to control the read only state of grid cells. Just like shown in my previous post you can handle the CellBeginEdit method to make a cell read-only. Nevertheless, if more people request the same feature we will reconsider our decision.

    Should you have any other questions, please contact me.

    Best wishes,
    Jack
    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.
  11. Matt
    Matt avatar
    15 posts
    Member since:
    Jan 2009

    Posted 24 Mar 2010 Link to this post

    Since it was first asked for in 2007 I won't hold out a great deal of hope.
  12. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 24 Mar 2010 Link to this post

    Hello Matt,

    Did the CellBeginEdit event help in solving the issue? If not, please describe it in detail and I will try to find a proper solution.
     

    Best wishes,
    Jack
    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.
  13. Matt
    Matt avatar
    15 posts
    Member since:
    Jan 2009

    Posted 24 Mar 2010 Link to this post

    I wish to make the row(s) read-only at the point of creating the row and not cater for it at the point of the user clicking on it.
  14. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 25 Mar 2010 Link to this post

    Hello Matt,

    I understand. Currently, there is no event that you can handle to initialize newly created rows. However, you can iterate all rows and set the Tag property. Later, you can use this property to indicate whether the row is read only or not. Please, describe in details the exact behavior that you want to achieve and I will try to find the best option for you.

     

    All the best,
    Jack
    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.
  15. lucerias
    lucerias avatar
    16 posts
    Member since:
    Nov 2011

    Posted 09 Nov 2011 Link to this post

    I want to make a single cell readonly = false so that it can be edited.
    What i want to achieve is something like this. I have three columns, first is CustomerID, second is CustomerAddress, last is Checkbox.

    All columns are in readonly.
    Whatever user tick on the checkbox, customeraddress must be editable.

    I have got the row already but not able to set CustomerAddress to be editable.

    My xaml code is shown as below. SilverLight version is 4.

    <telerik:GridViewDataColumn Header="Customer address" DataMemberBinding="{Binding CustomerAddress, Mode=TwoWay}" IsReadOnly="True" >
        <telerik:GridViewDataColumn.CellTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding CustomerAddress}" />
            </DataTemplate>
        </telerik:GridViewDataColumn.CellTemplate>
      
        <telerik:GridViewDataColumn.CellEditTemplate>
            <DataTemplate>
                <TextBox Text="{Binding CustomerAddress, Mode=TwoWay}"  />
            </DataTemplate>
        </telerik:GridViewDataColumn.CellEditTemplate>
    </telerik:GridViewDataColumn>

    My behind code is shown as below.

    CheckBox chk = (CheckBox)sender; 
    GridViewRow row = chk.ParentOfType<GridViewRow>();
      
    row.Cells[1].IsReadOnly = False not supported.

    I stuck at this for few days already. I have achieved using TextBox instead of TextBlock but the look and feel just not right.
    Hence i want it to be displayed in TextBlock and edit in TextBox.

    Please let me know the alternative. Thank you very much.
  16. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 10 Nov 2011 Link to this post

    Hello Lucerias,

     You may use the IsReadOnlyBinding instead of IsReadOnly. For further reference please take a look at this article

    I hope that this is what you need.

    Regards,
    Didie
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

  17. Tim
    Tim avatar
    1 posts
    Member since:
    Apr 2014

    Posted 23 Jul 2014 in reply to Dimitrina Link to this post

    Hello,
         In our project we need a particular cells in a row to be readonly subject to a condition applied to a value in another column of the row?     Is this possible to do yet?

    Best Regards,
    Tim
  18. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 25 Jul 2014 Link to this post

    Hello Tim,

    Thank you for writing.

    The CellBeginEdit event fires when the cell is about to enter edit mode. You can cancel edit mode (simulate read-only behavior) at this stage by setting the Cancel property to true:
    private void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
    {
        if (e.Column.Name == "UnitPrice" || e.Column.Name == "ProductName")
        {
            rowView = e.Row.DataBoundItem as DataRowView;
            if (rowView != null)
            {
                if (int.TryParse(rowView.Row["SupplierID"] + "", out id))
                {
                    if (id == 4)
                    {
                        e.Cancel = true;
                    }
                }
            }
        }
    }

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  19. Venkatesh
    Venkatesh avatar
    21 posts
    Member since:
    Jul 2014

    Posted 14 Aug 2014 in reply to Dess Link to this post

    Hi,

    I want to make read only for the rad grid cells based on a condition.
     
    Eg:  1      2     3      N/A    5        6      7     N/A
            23   34   56    12      N/A    12     10   33

    The cells which is having N/A i need to make read only.

    I am using radgrid batch edit with GridTemplateColumn. Label in ItemTemplate, RadNumericTextBox  in EditItemTemplate.


    Regards,
    Venkatesh.
  20. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 18 Aug 2014 Link to this post

    Hello Venkatesh,

    Thank you for writing.

    I am not sure whether your question is related to RadGridView from the Telerik UI for WinForms suite. However, you can also use the CellBeginEdit event and cancel it if the current cell's value or text is "N/A".

    Another approach to simulate read-only behavior is to use the CellFormatting event and set the CellElement.Enabled property to false and the UseDefaultDisabledPaint property to false as well. Thus, the user will not be allowed to edit the specific cell:
    private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
    {
        if (e.CellElement.Text != null && e.CellElement.Text == "N/A")
        {
            e.CellElement.Enabled = false;
            e.CellElement.UseDefaultDisabledPaint = false;
        }
        else
        {
            e.CellElement.Enabled = true;
            e.CellElement.UseDefaultDisabledPaint = true;
        }
    }

    If your question is related to RadGrid from the Telerik UI for ASP.NET AJAX suite, feel free to post your question in the appropriate forum.

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WinForms is Visual Studio 2017 Ready