本文整理匯總了C#中System.Web.UI.WebControls.DataControlRowState枚舉的典型用法代碼示例。如果您正苦於以下問題:C# DataControlRowState枚舉的具體用法?C# DataControlRowState怎麽用?C# DataControlRowState使用的例子?那麽, 這裏精選的枚舉代碼示例或許可以為您提供幫助。
在下文中一共展示了DataControlRowState枚舉的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: RadioButton
// This method adds a RadioButton control and any other
// content to the cell's Controls collection.
protected override void InitializeDataCell
(DataControlFieldCell cell, DataControlRowState rowState) {
RadioButton radio = new RadioButton();
// If the RadioButton is bound to a DataField, add
// the OnDataBindingField method event handler to the
// DataBinding event.
if (DataField.Length != 0) {
radio.DataBinding += new EventHandler(this.OnDataBindField);
}
radio.Text = this.Text;
// Because the RadioButtonField is a BoundField, it only
// displays data. Therefore, unless the row is in edit mode,
// the RadioButton is displayed as disabled.
radio.Enabled = false;
// If the row is in edit mode, enable the button.
if ((rowState & DataControlRowState.Edit) != 0 ||
(rowState & DataControlRowState.Insert) != 0) {
radio.Enabled = true;
}
cell.Controls.Add(radio);
}