Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can Property Descriptor gets values of two controls using same code line?
    primarykey
    data
    text
    <p>I found this code in one of the project developed by an Ex-Employee for custom gridview with custom controls which works fine but I am not sure what exactly it is doing,</p> <p><strong>CODE</strong>:</p> <pre><code>public class aBoundField : ImageField { //here I got some get set properties defined protected override void OnDataBindField(object sender, EventArgs e) { Control control = (Control)sender; PropertyDescriptor propertyA = TypeDescriptor.GetProperties(DataBinder.GetDataItem(control.NamingContainer)).Find("boundField", true); PropertyDescriptor propertyB = TypeDescriptor.GetProperties(DataBinder.GetDataItem(control.NamingContainer)).Find("boundField", true); PropertyAFieldValue = this.GetValue(control.NamingContainer, this._PropertyAField, ref propertyA).ToString(); PropertyBFieldValue = this.GetValue(control.NamingContainer, this._PropertyBField, ref propertyB).ToString(); base.OnDataBindField(sender, e); } </code></pre> <p>What's happening in <code>OnDataBindField</code> method especially when it is getting PropertyDescriptor. I did bit research and figured out that it is a property bag, but if it is a property bag How would it know what value is for property A or Property B in this code.</p> <pre><code> PropertyDescriptor propertyA = TypeDescriptor.GetProperties(DataBinder.GetDataItem(control.NamingContainer)).Find("boundField", true); PropertyDescriptor propertyB = TypeDescriptor.GetProperties(DataBinder.GetDataItem(control.NamingContainer)).Find("boundField", true); </code></pre> <p><strong>What I don't exactly understand is</strong></p> <p>How can <strong>Property Descriptor</strong> gets values of two controls using same code line </p> <pre><code>TypeDescriptor.GetProperties(DataBinder.GetDataItem(control.NamingContainer)).Find("boundField", true) </code></pre> <p>How would above code line will figure out if its for Property A or Property B.</p> <p>I tried to get values from one property descriptor thinking its a property bag but it didn't worked properly.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload