Enable/Disable a cell in gridview

5 posts, 1 answers
  1. Nitin Vikraman
    Nitin Vikraman avatar
    9 posts
    Member since:
    Apr 2010

    Posted 26 Apr 2010 Link to this post

    Hi,

        is it possible to enable or disable a specific cell in Gridview. i am using Winforms Q1 2010 SP1 version. 

    Regards,

    Nitin

  2. Alcatraz
    Alcatraz avatar
    15 posts
    Member since:
    Mar 2010

    Posted 27 Apr 2010 Link to this post

    hi Nitin,

    Jus use the cellformatting event of that grid, identify the column and then set the enabled property of the cell to false.

    like

    private

     

    void radGridView1_CellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)

     

    {

     

     

        if (e.CellElement.ColumnInfo.HeaderText == "Type")

     

            {

     

                e.CellElement.Enabled =

    false;

     

            }

     }

    Hope this helps

    Cheers
    Kris

     

  3. Answer
    Jack
    Admin
    Jack avatar
    2333 posts

    Posted 27 Apr 2010 Link to this post

    Hi Nitin Vikraman,

    You should handle the CellBeginEdit event and cancel it to prevent a cell from being edited. Or, you can make the cell look disabled by setting its Enabled property to false when handling the CellFormatting event. We plan to add a property which indicates whether a cell is read only in one of our upcoming releases. 
     
    Regards,
    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.
  4. Kristoffer
    Kristoffer avatar
    158 posts
    Member since:
    Dec 2012

    Posted 01 Nov 2013 Link to this post

    CellElement still has no ReadOnly property? I don't understand why this isn't supported. It makes perfect sense to:

    1) Allow editing "new row" column X value.
    2) Disallow editing existing row's column X value.

    A ReadOnly property of the cell would make life easier.
  5. Stefan
    Admin
    Stefan avatar
    2911 posts

    Posted 05 Nov 2013 Link to this post

    Hello,

    This can easily be achieved with the CellBeginEdit event as well. For the time being we do not have a ReadOnly property of the CellElement. If there is demand for such, we will consider adding it in a future release:
    void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
    {
        if (!(e.Row is GridViewNewRowInfo) || !(e.Column.Name == "ColumnX"))
        {
            e.Cancel = true;  
        }
    }

    I hope this helps.

    Regards,
    Stefan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top