本文整理汇总了C#中System.Web.UI.WebControls.DataControlField类的典型用法代码示例。如果您正苦于以下问题:C# DataControlField类的具体用法?C# DataControlField怎么用?C# DataControlField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataControlField类属于System.Web.UI.WebControls命名空间,在下文中一共展示了DataControlField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateChildControls
protected override int CreateChildControls(System.Collections.IEnumerable dataSource, bool dataBinding)
{
int numRows = base.CreateChildControls(dataSource, dataBinding);
//no data rows created, create empty table if enabled
if (numRows == 0 && ShowEmptyTable)
{
//create table
Table table = new Table();
table.ID = this.ID;
//create a new header row
GridViewRow row = base.CreateRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal);
//convert the exisiting columns into an array and initialize
DataControlField[] fields = new DataControlField[this.Columns.Count];
this.Columns.CopyTo(fields, 0);
this.InitializeRow(row, fields);
table.Rows.Add(row);
//create the empty row
row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
TableCell cell = new TableCell();
cell.ColumnSpan = this.Columns.Count;
cell.Width = Unit.Percentage(100);
cell.Controls.Add(new LiteralControl(EmptyTableRowText));
row.Cells.Add(cell);
table.Rows.Add(row);
this.Controls.Add(table);
}
return numRows;
}
示例2: CopyProperties
protected override void CopyProperties(DataControlField newField)
{
((CheckBoxField) newField).Text = this.Text;
this._suppressPropertyThrows = true;
((CheckBoxField) newField)._suppressPropertyThrows = true;
base.CopyProperties(newField);
this._suppressPropertyThrows = false;
((CheckBoxField) newField)._suppressPropertyThrows = false;
}
示例3: CopyProperties
protected override void CopyProperties(DataControlField newField)
{
((AutoGeneratedField) newField).DataType = this.DataType;
this._suppressPropertyThrows = true;
((AutoGeneratedField) newField)._suppressPropertyThrows = true;
base.CopyProperties(newField);
this._suppressPropertyThrows = false;
((AutoGeneratedField) newField)._suppressPropertyThrows = false;
}
示例4: CopyProperties
protected override void CopyProperties(DataControlField newField)
{
((ButtonField) newField).CommandName = this.CommandName;
((ButtonField) newField).DataTextField = this.DataTextField;
((ButtonField) newField).DataTextFormatString = this.DataTextFormatString;
((ButtonField) newField).ImageUrl = this.ImageUrl;
((ButtonField) newField).Text = this.Text;
base.CopyProperties(newField);
}
示例5: CopyProperties
protected override void CopyProperties(DataControlField newField)
{
((TemplateField) newField).ConvertEmptyStringToNull = this.ConvertEmptyStringToNull;
((TemplateField) newField).AlternatingItemTemplate = this.AlternatingItemTemplate;
((TemplateField) newField).ItemTemplate = this.ItemTemplate;
((TemplateField) newField).FooterTemplate = this.FooterTemplate;
((TemplateField) newField).EditItemTemplate = this.EditItemTemplate;
((TemplateField) newField).HeaderTemplate = this.HeaderTemplate;
((TemplateField) newField).InsertItemTemplate = this.InsertItemTemplate;
base.CopyProperties(newField);
}
示例6: CopyProperties
protected override void CopyProperties(DataControlField newField)
{
((HyperLinkField) newField).DataNavigateUrlFields = this.DataNavigateUrlFields;
((HyperLinkField) newField).DataNavigateUrlFormatString = this.DataNavigateUrlFormatString;
((HyperLinkField) newField).DataTextField = this.DataTextField;
((HyperLinkField) newField).DataTextFormatString = this.DataTextFormatString;
((HyperLinkField) newField).NavigateUrl = this.NavigateUrl;
((HyperLinkField) newField).Target = this.Target;
((HyperLinkField) newField).Text = this.Text;
base.CopyProperties(newField);
}
示例7: CopyProperties
protected override void CopyProperties(DataControlField newField)
{
((BoundField) newField).ApplyFormatInEditMode = this.ApplyFormatInEditMode;
((BoundField) newField).ConvertEmptyStringToNull = this.ConvertEmptyStringToNull;
((BoundField) newField).DataField = this.DataField;
((BoundField) newField).DataFormatString = this.DataFormatString;
((BoundField) newField).HtmlEncode = this.HtmlEncode;
((BoundField) newField).HtmlEncodeFormatString = this.HtmlEncodeFormatString;
((BoundField) newField).NullDisplayText = this.NullDisplayText;
((BoundField) newField).ReadOnly = this.ReadOnly;
base.CopyProperties(newField);
}
示例8: CopyProperties
protected override void CopyProperties(DataControlField newField)
{
((ImageField) newField).AlternateText = this.AlternateText;
((ImageField) newField).ConvertEmptyStringToNull = this.ConvertEmptyStringToNull;
((ImageField) newField).DataAlternateTextField = this.DataAlternateTextField;
((ImageField) newField).DataAlternateTextFormatString = this.DataAlternateTextFormatString;
((ImageField) newField).DataImageUrlField = this.DataImageUrlField;
((ImageField) newField).DataImageUrlFormatString = this.DataImageUrlFormatString;
((ImageField) newField).NullDisplayText = this.NullDisplayText;
((ImageField) newField).NullImageUrl = this.NullImageUrl;
((ImageField) newField).ReadOnly = this.ReadOnly;
base.CopyProperties(newField);
}
示例9: CopyProperties
protected virtual void CopyProperties(DataControlField newField)
{
newField.AccessibleHeaderText = this.AccessibleHeaderText;
newField.ControlStyle.CopyFrom(this.ControlStyle);
newField.FooterStyle.CopyFrom(this.FooterStyle);
newField.HeaderStyle.CopyFrom(this.HeaderStyle);
newField.ItemStyle.CopyFrom(this.ItemStyle);
newField.FooterText = this.FooterText;
newField.HeaderImageUrl = this.HeaderImageUrl;
newField.HeaderText = this.HeaderText;
newField.InsertVisible = this.InsertVisible;
newField.ShowHeader = this.ShowHeader;
newField.SortExpression = this.SortExpression;
newField.Visible = this.Visible;
}
示例10: GridViewDataBind
/// <summary>
/// 绑定数据到GridView,当表格数据为空时显示表头
/// </summary>
/// <param name="gridview"></param>
/// <param name="dt">DataTable</param>
/// <param name="dataKeys"></param>
public static void GridViewDataBind(GridView gridview, DataTable dt, string[] dataKeyName, string emptyText)
{
EmptyText = emptyText;
//记录为空重新构造Gridview
if (dt.Rows.Count == 0)
{
gridview.DataSource = dt;
gridview.DataBind();
if (gridview.EmptyDataTemplate != null)
{
GridViewRow rowHeader = new GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal);
DataControlField[] tempDataControlField = new DataControlField[gridview.Columns.Count];
int i = 0;
foreach (DataControlField field in gridview.Columns)
{
tempDataControlField[i] = field;
i++;
}
InitializeRow(gridview, rowHeader, tempDataControlField);
gridview.Controls[0].Controls.Add(rowHeader);
GridViewRow rowBody = new GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal);
TableCell cellBody = new TableCell();
cellBody.Text = EmptyText;
cellBody.HorizontalAlign = HorizontalAlign.Center;
cellBody.ColumnSpan = i;
rowBody.Cells.Add(cellBody);
rowBody.CssClass = "";
gridview.Controls[0].Controls.Add(rowBody);
}
}
else
{
//数据不为空直接绑定
gridview.DataSource = dt;
gridview.DataKeyNames = dataKeyName;
gridview.DataBind();
}
//重新绑定取消选择
gridview.SelectedIndex = -1;
}
示例11: OnRowCreated
protected override void OnRowCreated(GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string sControl;
sControl = "~/Apps/EventService/Modules/row_default.ascx";
e.Row.Cells.Clear();
DataControlField field = this.Columns[0];
((TemplateField)field).ItemTemplate = this.Page.LoadTemplate(sControl);
DataControlField[] fields = new DataControlField[1] { field };
this.InitializeRow(e.Row, fields);
}
base.OnRowCreated(e);
}
示例12: GetTemplateField
internal static TemplateField GetTemplateField(DataControlField dataControlField, DataBoundControl dataBoundControl)
{
TemplateField field = new TemplateField {
HeaderText = dataControlField.HeaderText,
HeaderImageUrl = dataControlField.HeaderImageUrl,
AccessibleHeaderText = dataControlField.AccessibleHeaderText,
FooterText = dataControlField.FooterText,
SortExpression = dataControlField.SortExpression,
Visible = dataControlField.Visible,
InsertVisible = dataControlField.InsertVisible,
ShowHeader = dataControlField.ShowHeader
};
field.ControlStyle.CopyFrom(dataControlField.ControlStyle);
field.FooterStyle.CopyFrom(dataControlField.FooterStyle);
field.HeaderStyle.CopyFrom(dataControlField.HeaderStyle);
field.ItemStyle.CopyFrom(dataControlField.ItemStyle);
return field;
}
示例13: CopyProperties
protected override void CopyProperties(DataControlField newField)
{
((CommandField) newField).CancelImageUrl = this.CancelImageUrl;
((CommandField) newField).CancelText = this.CancelText;
((CommandField) newField).DeleteImageUrl = this.DeleteImageUrl;
((CommandField) newField).DeleteText = this.DeleteText;
((CommandField) newField).EditImageUrl = this.EditImageUrl;
((CommandField) newField).EditText = this.EditText;
((CommandField) newField).InsertImageUrl = this.InsertImageUrl;
((CommandField) newField).InsertText = this.InsertText;
((CommandField) newField).NewImageUrl = this.NewImageUrl;
((CommandField) newField).NewText = this.NewText;
((CommandField) newField).SelectImageUrl = this.SelectImageUrl;
((CommandField) newField).SelectText = this.SelectText;
((CommandField) newField).UpdateImageUrl = this.UpdateImageUrl;
((CommandField) newField).UpdateText = this.UpdateText;
((CommandField) newField).ShowCancelButton = this.ShowCancelButton;
((CommandField) newField).ShowDeleteButton = this.ShowDeleteButton;
((CommandField) newField).ShowEditButton = this.ShowEditButton;
((CommandField) newField).ShowSelectButton = this.ShowSelectButton;
((CommandField) newField).ShowInsertButton = this.ShowInsertButton;
base.CopyProperties(newField);
}
示例14: CopyProperties
/// <summary>
/// Overridden. Copies the properties of the current HyperLinkField object to the specified object.
/// </summary>
/// <param name="newField"></param>
protected override void CopyProperties(DataControlField newField)
{
base.CopyProperties(newField);
HyperLinkField field = (HyperLinkField)newField;
field.DataNavigateUrlFields = DataNavigateUrlFields;
field.DataNavigateUrlFormatString = DataNavigateUrlFormatString;
field.DataTextField = DataTextField;
field.DataTextFormatString = DataTextFormatString;
field.NavigateUrl = NavigateUrl;
field.Target = Target;
field.Text = Text;
}
示例15: DataControlFieldCell
protected DataControlFieldCell(HtmlTextWriterTag tagKey, DataControlField containingField) : base(tagKey) {
_containingField = containingField;
}