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

[Solved] Hidding Field in EditMode on DetailsView

2 Answers 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcio Nascimento
Top achievements
Rank 1
Marcio Nascimento asked on 08 Oct 2009, 03:34 PM
Hi there,

Well, I'm having trouble in how to hide fields in EditMode when use DetailsView.

I tried without success with the following code...

        string nome = e.Item.OwnerTableView.Name;  
        if (nome == "valores")  
        {  
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode))  
            {  
                GridEditFormItem myColumn = (GridEditFormItem)e.Item;  
                {  
                    myColumn["id_postosQT"].Parent.Visible = false;  
                }  
            }  
        } 

The error is: Cannot find a cell bound to column name 'id_postosQT'.

Someone could give me a hand on this ?

Regards,

Marcio Nascimento

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 09 Oct 2009, 07:53 AM
Hello Marcio,

This usually happens when you try to access a non-existing column,in code-behind ("id_postosQT", in your case),i.e, the column is not found in the column collection of the ownertableview. So make sure that this column does exist in the column collection of your detailtable.
 
Thanks
Princy.
0
Marcio Nascimento
Top achievements
Rank 1
answered on 15 Oct 2009, 03:07 PM
Hi Princy,

You're right. The column id was not set up correctly.
Sometimes I forget the basics....

Thanks.

Marcio Nascimento
Tags
Grid
Asked by
Marcio Nascimento
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Marcio Nascimento
Top achievements
Rank 1
Share this question
or