Hiding Property for Binding

  • Thread starter Thread starter Burrows
  • Start date Start date
B

Burrows

Hi was wanting to know if this is postible I have a genteric List<T>
customerList<Customer> (customer is my oen data class) and I wish to
to bind it to a dataGrid but i do not want all properties shows

this.dataGrid1.DataSource = customerList;

I was wondering if there is an attibute i could apply to the
properties i did not wish to show in the data class ????

Any help would be great
 
Burrows said:
Hi was wanting to know if this is postible I have a genteric List<T>
customerList<Customer> (customer is my oen data class) and I wish to
to bind it to a dataGrid but i do not want all properties shows

this.dataGrid1.DataSource = customerList;

I was wondering if there is an attibute i could apply to the
properties i did not wish to show in the data class ????

Any help would be great

There are events on the dataGrid, like RowCreated or something like that
along with Cell attributes like Visible. In the example below, I am telling
the grid to hide certain properties of yhe objects that are bound to the
control using List<T>.

Use Google or Bing and find other examples of doing this through the
control itself.

protected void dvDepartment_RowCreated(object sender, GridViewRowEventArgs
e)

{

e.Row.Cells[1].Visible = false; //ID

e.Row.Cells[5].Visible = false; //IsDirty

e.Row.Cells[6].Visible = false; //IsNew

}


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4331 (20090813) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
Hi was wanting to know if this is postible I have a genteric List<T>
customerList<Customer> (customer is my oen data class) and I wish to
to bind it to a  dataGrid but i do not want all properties shows
this.dataGrid1.DataSource = customerList;
I was wondering if there is an attibute i could apply to the
properties i did not wish to show in the data class ????
Any help would be great

There are events on the dataGrid, like RowCreated or something like that
along with Cell attributes like Visible. In the example below, I am telling
the grid to hide certain properties of yhe objects that are bound to the
control using List<T>.

Use Google  or Bing and find other examples of doing this through the
control itself.

protected void dvDepartment_RowCreated(object sender, GridViewRowEventArgs
e)

{

e.Row.Cells[1].Visible = false; //ID

e.Row.Cells[5].Visible = false; //IsDirty

e.Row.Cells[6].Visible = false; //IsNew

}

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4331 (20090813) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Thanks but was hoping there was something I could do to my data class
to suppress the property.
 
Hi was wanting to know if this is postible I have a genteric List<T>
customerList<Customer> (customer is my oen data class) and I wish to
to bind it to a dataGrid but i do not want all properties shows
this.dataGrid1.DataSource = customerList;
I was wondering if there is an attibute i could apply to the
properties i did not wish to show in the data class ????
Any help would be great

There are events on the dataGrid, like RowCreated or something like that
along with Cell attributes like Visible. In the example below, I am
telling
the grid to hide certain properties of yhe objects that are bound to the
control using List<T>.

Use Google or Bing and find other examples of doing this through the
control itself.

protected void dvDepartment_RowCreated(object sender, GridViewRowEventArgs
e)

{

e.Row.Cells[1].Visible = false; //ID

e.Row.Cells[5].Visible = false; //IsDirty

e.Row.Cells[6].Visible = false; //IsNew

}

__________ Information from ESET NOD32 Antivirus, version of virus
signature database 4331 (20090813) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Thanks but was hoping there was something I could do to my data class
to suppress the property.


The answer is 'no'.


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4331 (20090813) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
Back
Top