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

Want to hide row in EditColumn but not in Insert Mode

4 Answers 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 07 Jan 2011, 10:53 PM
I have a RadGrid  with <EditFormSettings>  and <EditColumn> which the ComandItemDisplay="Top" to get the Insert Section,  which works fine normally.

I have a particular GridBoundCoumn 

When in Edit Mode,  I don't not want this row to show up.

However in Insert Mode,  I do want it to show up.  Whenever I affect the visibility of this GridEditableItem in the ItemDataBound it seems to also affect that item in the Insert mode as well.   And I have trouble accessing their Header Labels as well.

How can I achieve this.

4 Answers, 1 is accepted

Sort by
0
Mike Nogen
Top achievements
Rank 1
answered on 08 Jan 2011, 12:43 AM
Hello!

I´m not sure that I understand what you want to do. But try this.

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem item = (GridEditableItem)e.Item;
  
                if (e.Item is GridEditFormInsertItem)
                {
                    item["Price"].Visible = true;
                }
                else
                {
                    item["Price"].Visible = false;
                }
            }
        }




0
Chris
Top achievements
Rank 1
answered on 10 Jan 2011, 04:27 PM
Thanks it works ok.  But what about it's description label to the left of it?  It is still visible

Such as

Price:   

I would like to hide that to.  Better yet, remove the entire row so that is does not take of real estate on the screen.
0
Accepted
Princy
Top achievements
Rank 2
answered on 11 Jan 2011, 05:26 AM
Hello Chris,

Check out the following code snippet which shows how to achieve this.

C#:
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem item = (GridEditableItem)e.Item;
        item["Price"].Parent.Visible = false;
    }

Thanks,
Princy.
0
Chris
Top achievements
Rank 1
answered on 11 Jan 2011, 07:21 PM
Thanks!
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Mike Nogen
Top achievements
Rank 1
Chris
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or