本文整理汇总了C#中System.Web.UI.WebControls.DataControlFieldCell类的典型用法代码示例。如果您正苦于以下问题:C# DataControlFieldCell类的具体用法?C# DataControlFieldCell怎么用?C# DataControlFieldCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataControlFieldCell类属于System.Web.UI.WebControls命名空间,在下文中一共展示了DataControlFieldCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeCell
public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
{
chkBox = new CheckBox {ID = "chkBool", Enabled = false};
cell.Controls.Add(chkBox);
base.InitializeCell(cell, cellType, rowState, rowIndex);
}
示例2: InitializeControls
protected override void InitializeControls(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
{
image = new Image();
image.SetId(ChildId);
cell.Controls.Add(image);
}
示例3: InitializeDataCell
protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
{
DropDownList ddl = new DropDownList();
ddl.Items.Add("");
ddl.AppendDataBoundItems = true;
if (!string.IsNullOrEmpty(this.DataSourceID) || null != this.DataSource)
{
if (!string.IsNullOrEmpty(this.DataSourceID))
{
ddl.DataSourceID = this.DataSourceID;
}
else
{
ddl.DataSource = this.DataSource;
}
ddl.DataTextField = this.DataTextField;
ddl.DataValueField = this.DataValueField;
}
if (this.DataField.Length != 0)
{
ddl.DataBound += new EventHandler(this.OnDataBindField);
}
ddl.Enabled = false;
if ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal || (rowState & DataControlRowState.Insert) != DataControlRowState.Normal)
{
ddl.Enabled = true;
}
cell.Controls.Add(ddl);
}
示例4: InitializeControls
protected override void InitializeControls(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
{
button = new LinkButton { CommandName = CommandName };
button.SetId(ChildId);
if (Click != null) button.Click += Click;
cell.Controls.Add(button);
tooltipbutton = new LinkButton { CommandName = CommandName, Visible = false};
tooltipbutton.SetId(ChildId);
cell.Controls.Add(tooltipbutton);
if (ShowLabelIfDisabled)
{
labelIfDisabled = new Label { Visible = false };
cell.Controls.Add(labelIfDisabled);
tooltiplabelIfDisabled = new Label { Visible = false };
cell.Controls.Add(tooltiplabelIfDisabled);
}
}
示例5: InitializeCell
public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
{
base.InitializeCell(cell, cellType, rowState, rowIndex);
if (cell == null)
{
throw new ArgumentNullException("cell");
}
ImageButton button3 = new ImageButton {
ID = "rise",
ImageUrl = this.RiseUrl,
CommandName = "Rise"
};
ImageButton child = button3;
ImageButton button4 = new ImageButton {
ID = "fall",
ImageUrl = this.FallUrl,
CommandName = "Fall"
};
ImageButton button2 = button4;
if (cellType == DataControlCellType.DataCell)
{
cell.Controls.Add(button2);
cell.Controls.Add(child);
}
}
示例6: InitializeCell
public override void InitializeCell(
DataControlFieldCell cell,
DataControlCellType cellType,
DataControlRowState rowState,
int rowIndex)
{
if (cellType == DataControlCellType.DataCell)
{
var control = new DynamicControl() { DataField = DataField };
// Copy various properties into the control
control.UIHint = UIHint;
control.HtmlEncode = HtmlEncode;
control.NullDisplayText = NullDisplayText;
// this the default for DynamicControl and has to be
// manually changed you do not need this line of code
// its there just to remind us what we are doing.
control.Mode = DataBoundControlMode.ReadOnly;
cell.Controls.Add(control);
}
else
{
base.InitializeCell(cell, cellType, rowState, rowIndex);
}
}
示例7: ExtractValuesFromCell
public override void ExtractValuesFromCell(IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly)
{
Control control = null;
string dataField = this.DataField;
object obj2 = null;
if (cell.Controls.Count > 0)
{
control = cell.Controls[0];
CheckBox box = control as CheckBox;
if ((box != null) && (includeReadOnly || box.Enabled))
{
obj2 = box.Checked;
}
}
if (obj2 != null)
{
if (dictionary.Contains(dataField))
{
dictionary[dataField] = obj2;
}
else
{
dictionary.Add(dataField, obj2);
}
}
}
示例8: InitializeDataCell
protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
{
//base.InitializeDataCell(cell, rowState);
TextBox textBox = new TextBox();
textBox.ID = this.ControlID;
textBox.Width = new Unit(GridColumn.Width, UnitType.Pixel);
if (GridColumn.Size != 0) textBox.MaxLength = GridColumn.Size;
textBox.DataBinding += new EventHandler(this.textBox_DataBinding);
base.InitializeDataCell(cell, rowState);
cell.Controls.Add(textBox);
CompareValidator vld = new CompareValidator();
vld.ControlToValidate = textBox.ID;
vld.ID = textBox.ID + "vld";
vld.Operator = ValidationCompareOperator.DataTypeCheck;
vld.ErrorMessage = "не верный формат (2)";
vld.Text = "! (2)";
vld.Display = ValidatorDisplay.Dynamic;
if (GridColumn.Type == typeof(int)) vld.Type = ValidationDataType.Integer;
if (GridColumn.Type == typeof(decimal)) vld.Type = ValidationDataType.Double;
if (GridColumn.Type == typeof(string)) vld.Type = ValidationDataType.String;
cell.Controls.Add(vld);
if (!GridColumn.AllowNULL)
{
RequiredFieldValidator reqvld = new RequiredFieldValidator();
reqvld.ControlToValidate = textBox.ID;
reqvld.ID = textBox.ID + "reqvld";
reqvld.ErrorMessage = "поле не может быть пустым (1)";
reqvld.Text = "! (1)";
reqvld.Display = ValidatorDisplay.Dynamic;
cell.Controls.Add(reqvld);
}
}
示例9: Case0
void Case0 (DataControlFieldCell cell)
{
CheckBox checkBox = new CheckBox();
checkBox.ToolTip = "Dummy";
cell.Controls.Add(checkBox);
checkBox.DataBinding += OnDataBindField;
}
示例10: InitializeDataCell
protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
{
CheckBox child = null;
CheckBox box2 = null;
if ((((rowState & DataControlRowState.Edit) != DataControlRowState.Normal) && !this.ReadOnly) || ((rowState & DataControlRowState.Insert) != DataControlRowState.Normal))
{
CheckBox box3 = new CheckBox {
ToolTip = this.HeaderText
};
child = box3;
if ((this.DataField.Length != 0) && ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal))
{
box2 = box3;
}
}
else if (this.DataField.Length != 0)
{
CheckBox box4 = new CheckBox {
Text = this.Text,
Enabled = false
};
child = box4;
box2 = box4;
}
if (child != null)
{
cell.Controls.Add(child);
}
if ((box2 != null) && base.Visible)
{
box2.DataBinding += new EventHandler(this.OnDataBindField);
}
}
示例11: CreateControlLink
public HyperLink CreateControlLink(DataControlFieldCell cell
, String IdPropertyName
, String controllerObjectName
, String onClickClientEvent
, String imageUrl
, String altText
, Int32 columnIndex
, String businessKeyProperty
)
{
GridViewRow row = (GridViewRow)cell.BindingContainer;
if (row == null)
return null;
String value = GetObjectValue(row.DataItem, IdPropertyName);
String businessKeyPropertyValue = GetObjectValue(row.DataItem, businessKeyProperty);
if (String.IsNullOrEmpty(cell.Text) || String.Compare(cell.Text, " ") == 0 ||
String.IsNullOrEmpty(value))
return null;
HyperLink link = new HyperLink();
link.Text = cell.Text;
link.NavigateUrl = GetNavigationUrl(value, businessKeyPropertyValue, controllerObjectName, onClickClientEvent, columnIndex);
if (!String.IsNullOrEmpty(imageUrl))
link.Controls.Add(CreateImage(imageUrl, altText));
_navigateURL = link.NavigateUrl;
_text = link.Text;
_image = imageUrl;
return link;
}
示例12: InitializeCell
public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
{
base.InitializeCell(cell, cellType, rowState, rowIndex);
if (ColumnStyle != null)
{
if (HeaderStyle.CssClass.IsNullOrEmpty()) HeaderStyle.CssClass = ColumnStyle;
if (ItemStyle.CssClass.IsNullOrEmpty()) ItemStyle.CssClass = ColumnStyle;
if (FooterStyle.CssClass.IsNullOrEmpty()) FooterStyle.CssClass = ColumnStyle;
}
if (cellType != DataControlCellType.DataCell) return;
ButtonEx buttonEx = string.IsNullOrEmpty(Message) ? new ButtonEx() : new MessageButton { Message = Message};
buttonEx.CommandName = CommandName;
buttonEx.ToolTip = ResourceManager.GetString(ToolTip);
buttonEx.LeftIconCssClass = IconName == null ? string.Empty : IconName.Name;
buttonEx.ShowText = false;
buttonEx.OnClientClick = OnClickClick;
if (Click != null)
{
if (buttonEx is MessageButton)
((MessageButton) buttonEx).Confirm += Click;
else
buttonEx.Click += Click;
}
cell.Controls.Add(buttonEx);
}
示例13: InitializeDataCell
protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
{
//base.InitializeDataCell(cell, rowState);
HyperLink link = new HyperLink();
link.DataBinding += new EventHandler(this.link_DataBinding);
link.CssClass = "thickbox";
cell.Controls.Add(link);
}
示例14: InitializeControls
protected override void InitializeControls(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
{
button = new ImageButton { ImageUrl = "", CommandName = CommandName };
button.SetId(ChildId);
if (Click != null) button.Click += Click;
cell.Controls.Add(button);
}
示例15: InitializeDataCell
protected override void InitializeDataCell (DataControlFieldCell cell, DataControlRowState rowState)
{
if ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal) {
TextBox textBox = new TextBox ();
cell.Controls.Add (textBox);
textBox.DataBinding += OnDataBindField;
} else
base.InitializeDataCell (cell, rowState);
}