Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>And here is the method that performs the data binding. You can exactly see what is going on:</p> <pre><code>protected internal override void PerformDataBinding(IEnumerable dataSource) { base.PerformDataBinding(dataSource); if (dataSource != null) { bool flag = false; bool flag2 = false; string dataTextField = this.DataTextField; string dataValueField = this.DataValueField; string dataTextFormatString = this.DataTextFormatString; if (!this.AppendDataBoundItems) { this.Items.Clear(); } ICollection is2 = dataSource as ICollection; if (is2 != null) { this.Items.Capacity = is2.Count + this.Items.Count; } if ((dataTextField.Length != 0) || (dataValueField.Length != 0)) { flag = true; } if (dataTextFormatString.Length != 0) { flag2 = true; } foreach (object obj2 in dataSource) { ListItem item = new ListItem(); if (flag) { if (dataTextField.Length &gt; 0) { item.Text = DataBinder.GetPropertyValue(obj2, dataTextField, dataTextFormatString); } if (dataValueField.Length &gt; 0) { item.Value = DataBinder.GetPropertyValue(obj2, dataValueField, null); } } else { if (flag2) { item.Text = string.Format(CultureInfo.CurrentCulture, dataTextFormatString, new object[] { obj2 }); } else { item.Text = obj2.ToString(); } item.Value = obj2.ToString(); } this.Items.Add(item); } } if (this.cachedSelectedValue != null) { int num = -1; num = this.Items.FindByValueInternal(this.cachedSelectedValue, true); if (-1 == num) { throw new ArgumentOutOfRangeException("value", SR.GetString("ListControl_SelectionOutOfRange", new object[] { this.ID, "SelectedValue" })); } if ((this.cachedSelectedIndex != -1) &amp;&amp; (this.cachedSelectedIndex != num)) { throw new ArgumentException(SR.GetString("Attributes_mutually_exclusive", new object[] { "SelectedIndex", "SelectedValue" })); } this.SelectedIndex = num; this.cachedSelectedValue = null; this.cachedSelectedIndex = -1; } else if (this.cachedSelectedIndex != -1) { this.SelectedIndex = this.cachedSelectedIndex; this.cachedSelectedIndex = -1; } } </code></pre>
 

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