本文整理汇总了C#中System.Web.UI.WebControls.TableHeaderCell类的典型用法代码示例。如果您正苦于以下问题:C# TableHeaderCell类的具体用法?C# TableHeaderCell怎么用?C# TableHeaderCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableHeaderCell类属于System.Web.UI.WebControls命名空间,在下文中一共展示了TableHeaderCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindGrid
public static void BindGrid(this GridView grid, object dataSource, string emptyText)
{
grid.DataSource = dataSource;
grid.DataBind();
if (grid.Rows.Count == 0)
{
var table = new Table();
table.CssClass = grid.CssClass;
var tr = new TableHeaderRow();
foreach (DataControlField column in grid.Columns)
{
if (column.Visible)
{
var th = new TableHeaderCell();
th.Width = column.HeaderStyle.Width;
th.Text = column.HeaderText;
tr.Controls.Add(th);
}
}
table.Controls.Add(tr);
if (!string.IsNullOrEmpty(emptyText))
{
var emptyRow = new TableRow();
var emptyCell = new TableCell();
emptyCell.CssClass = "empty";
emptyCell.ColumnSpan = tr.Controls.Count;
emptyCell.Text = emptyText;
emptyRow.Controls.Add(emptyCell);
table.Controls.Add(emptyRow);
}
grid.Parent.Controls.Add(table);
}
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource sds = DatabaseManager.CreateSQLDataSource("SELECT INS_REQ_ID รหัส,PS_CITIZEN_ID รหัสบัตรประชาชน,INS_GRADEINSIGNIA_ID ลำดับเครื่องราช,REQ_DATE วันที่ขอ,STATE สถานะการขอ FROM INSG_REQUEST ");
GridView1.DataSource = sds;
GridView1.DataBind();
Util.NormalizeGridViewDate(GridView1, 3);
TableHeaderCell newHeader = new TableHeaderCell();
newHeader.Text = "เลือก";
GridView1.HeaderRow.Cells.Add(newHeader);
for (int i = 0; i < GridView1.Rows.Count; ++i)
{
string id = GridView1.Rows[i].Cells[0].Text;
Form1Package f1 = DatabaseManager.GetForm1Package(id);
LinkButton lbu = new LinkButton();
lbu.Text = "เลือก";
lbu.CssClass = "ps-button";
lbu.Click += (e2, e3) =>
{
MultiView1.ActiveViewIndex = 1;
};
TableCell cell = new TableCell();
cell.Controls.Add(lbu);
GridView1.Rows[i].Cells.Add(cell);
}
}
示例3: fillButtons
protected void fillButtons()
{
// Create the row
// We are going to use one row only
TableRow row = new TableRow();
// Create the cells
TableHeaderCell addRecordsCell = new TableHeaderCell();
TableHeaderCell addTimeOffCell = new TableHeaderCell();
TableHeaderCell addIncomeCell = new TableHeaderCell();
TableHeaderCell addDocumentCell = new TableHeaderCell();
// Add the links to cells Text
addRecordsCell.Text = @"<a class='btn btn-warning btn-employee' href='EmployeeAddRecord.aspx?id="+employee.Id+"'><i class='icon-pencil icon-white'></i> Add a Record</a>";
addTimeOffCell.Text = @"<a class='btn btn-warning btn-employee' href='EmployeeAddTimeOff.aspx?id=" + employee.Id + "'><i class='icon-calendar icon-white'></i> Add a Time Off</a>";
addIncomeCell.Text = @"<a class='btn btn-warning btn-employee' href='EmployeeAddIncome.aspx?id=" + employee.Id + "'><i class='icon-plus icon-white'></i> Add an Income</a>";
addDocumentCell.Text = @"<a class='btn btn-warning btn-employee' href='EmployeeAddDocument.aspx?id=" + employee.Id + "'><i class='icon-folder-open icon-white'></i> Add a Document</a>";
// Add the cells to the row
row.Cells.Add(addRecordsCell);
row.Cells.Add(addTimeOffCell);
row.Cells.Add(addIncomeCell);
row.Cells.Add(addDocumentCell);
// Add the row to the table
ButtonsTable.Rows.Add(row);
// Add the bootstrap table class to the table
ButtonsTable.CssClass = "table centerTD no-border-table buttons-table";
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
List<Models.CallType> allCallTypes = CallTypeController.getAllCallTypes();
TableRow headerRow = new TableRow();
TableHeaderCell header = new TableHeaderCell();
header.Text = "ID";
headerRow.Cells.Add(header);
header = new TableHeaderCell();
header.Text = "Call Type";
headerRow.Cells.Add(header);
this.callTypeResultsTable.Rows.Add(headerRow);
foreach (Models.CallType aType in allCallTypes)
{
TableRow row = new TableRow();
TableCell cellId = new TableCell();
TableCell cellText = new TableCell();
cellId.Text = aType.Id.ToString();
cellText.Text = aType.CallType1;
row.Cells.Add(cellId);
row.Cells.Add(cellText);
this.callTypeResultsTable.Rows.Add(row);
}
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
for (int rowCount = 0; rowCount < brochure.Length; rowCount++) {
TableRow row = new TableRow();
row.ID = "row" + rowCount;
table1.Rows.Add(row);
for (int colCount = 0; colCount < 2; colCount++) {
TableCell cell = new TableCell();
cell.ID = String.Format("cell {0}{1}", rowCount, colCount);
row.Cells.Add(cell);
if (colCount == 0) {
Label label = new Label();
label.ID = String.Format("label{0}{1}", rowCount, colCount);
label.Text = brochure[rowCount];
cell.Controls.Add(label);
}
else {
TextBox textBox = new TextBox();
textBox.ID = String.Format("textBox{0}{1}", rowCount, colCount);
Debug.WriteLine(textBox.ID);
cell.Controls.Add(textBox);
}
}
}
TableHeaderRow tableHeader = new TableHeaderRow();
TableHeaderCell cell1 = new TableHeaderCell();
TableHeaderCell cell2 = new TableHeaderCell();
cell1.Text = "Brochure";
cell2.Text = "Antal";
tableHeader.Cells.Add(cell1);
tableHeader.Cells.Add(cell2);
table1.Rows.AddAt(0, tableHeader);
}
示例6: GetHeaderCell
private TableHeaderCell GetHeaderCell(string innerText, string AssociatedControlId, bool alignRight, int width)
{
using (TableHeaderCell header = new TableHeaderCell())
{
if (alignRight)
{
header.Attributes.Add("class", "text-right");
}
if (width > 0)
{
header.Attributes.Add("style", "width:" + width.ToString(CultureInfo.InvariantCulture) + "px;");
}
if (string.IsNullOrWhiteSpace(AssociatedControlId))
{
header.Text = innerText;
}
else
{
using (HtmlGenericControl label = new HtmlGenericControl())
{
label.TagName = "label";
label.Attributes.Add("for", AssociatedControlId);
label.InnerText = innerText;
header.Controls.Add(label);
}
}
return header;
}
}
示例7: Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
//Put user code to initialize the page here
base.GHTTestBegin((HtmlForm)this.FindControl("Form1"));
try
{
base.GHTSubTestBegin("TableHeaderCell");
base.GHTActiveSubTest.Controls.Add(Table1);
// Create a header for the table.
System.Web.UI.WebControls.TableHeaderCell header = new System.Web.UI.WebControls.TableHeaderCell();
header.Text = "Table of (x,y) Values";
// Add the header row to the table.
Table1.Rows.AddAt(0, new TableRow());
Table1.Rows[0].Cells.Add(header);
}
catch (Exception ex)
{
base.GHTSubTestUnexpectedExceptionCaught(ex);
}
base.GHTSubTestEnd();
base.GHTTestEnd();
}
示例8: SummaryReportGridView_OnDataBound
protected void SummaryReportGridView_OnDataBound(object sender, EventArgs e)
{
GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
TableHeaderCell cell = new TableHeaderCell();
cell.Text = "";
cell.ColumnSpan = 2;
row.Controls.Add(cell);
row.BackColor = ColorTranslator.FromHtml("#9e1b34");
row.ForeColor = ColorTranslator.FromHtml("White");
SummaryReportGridView.Rows[7].Style.Add(HtmlTextWriterStyle.FontWeight, "Bold");
row.HorizontalAlign = HorizontalAlign.Center;
foreach (GridViewRow row2 in SummaryReportGridView.Rows)
{
LinkButton lb = (LinkButton)row2.Cells[0].Controls[0];
lb.ForeColor = ColorTranslator.FromHtml("#0000EE");
}
LinkButton lb2 = (LinkButton)SummaryReportGridView.Rows[7].Cells[0].Controls[0];
lb2.Enabled = false;
lb2.ControlStyle.Font.Underline = false;
lb2.ForeColor = ColorTranslator.FromHtml("Black");
lb2.ControlStyle.Font.Bold = true;
}
示例9: BuildCampaignsTable
private void BuildCampaignsTable()
{
TableHeaderCell hCell = null;
TableHeaderRow hRow = null;
this.campaignsTable.Rows.Clear();
hRow = new TableHeaderRow();
hCell = new TableHeaderCell();
hCell.Text = "Id";
hCell.ID = "campaignIdHeaderTH";
hCell.CssClass = "EditorTableHeaders";
hRow.Cells.Add(hCell);
hCell = new TableHeaderCell();
hCell.Text = "Description";
hCell.ID = "campaignDescriptionHeaderTH";
hCell.CssClass = "EditorTableHeaders";
hRow.Cells.Add(hCell);
hCell = new TableHeaderCell();
hCell.Text = "Status";
hCell.ID = "statusHeaderTH";
hCell.CssClass = "EditorTableHeaders";
hRow.Cells.Add(hCell);
this.campaignsTable.Rows.Add(hRow);
this.countLabel.Text = "Campaign Schedules Found: 0";
this.campaignsTable.Attributes.Add("class", "sortable EditorTables");
}
示例10: AddHeaderCell
private static TableCell AddHeaderCell(TableRow trow, string text)
{
TableHeaderCell cell = new TableHeaderCell {
Text = text
};
trow.Cells.Add(cell);
return cell;
}
示例11: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
if (!CtoF.Checked && !FtoC.Checked || CtoF.Checked && FtoC.Checked) {
ModelState.AddModelError(String.Empty,
"Välj konvertering från Celsius till Fahrenheit eller från Fahrenheit till Celsius");
}
if (IsValid) {
var start = int.Parse(Start.Text);
var end = int.Parse(End.Text);
var step = int.Parse(Step.Text);
var thead = new TableHeaderRow();
var theadC = new TableHeaderCell {
Text = "°C"
};
var theadF = new TableHeaderCell {
Text = "°F"
};
if (CtoF.Checked) {
thead.Cells.Add(theadC);
thead.Cells.Add(theadF);
} else {
thead.Cells.Add(theadF);
thead.Cells.Add(theadC);
}
Table.Rows.Add(thead);
for (int temp = start; temp <= end; temp += step) {
var trow = new TableRow();
trow.Cells.Add(new TableCell {
Text = temp.ToString()
});
if (CtoF.Checked) {
trow.Cells.Add(new TableCell {
Text = TemperatureConverter.CelsiusToFahrenheit(temp).ToString()
});
} else {
trow.Cells.Add(new TableCell {
Text = TemperatureConverter.FahrenheitToCelsius(temp).ToString()
});
}
Table.Rows.Add(trow);
}
Table.Visible = true;
} else {
Table.Visible = false;
}
}
示例12: Page_Init
protected void Page_Init(object sender, EventArgs e)
{
if (Request.Cookies["UserSettings"] != null)
{
if (Request.Cookies["UserSettings"]["Name"] != null)
linkBtnUsername.Text = Request.Cookies["UserSettings"]["Name"];
else
Response.Redirect("login.aspx");
}
else
Response.Redirect("login.aspx");
if (Session["userID"] == null)
Response.Redirect("board.aspx");
List<string> results = (List<string>)Session["links"];
TableHeaderRow thr = new TableHeaderRow();
TableHeaderCell thc = new TableHeaderCell();
TableHeaderCell thc1 = new TableHeaderCell();
TableHeaderCell thc2 = new TableHeaderCell();
TableHeaderCell thc3 = new TableHeaderCell();
thr.Cells.Add(thc);
thc.Text = "Title";
thr.Cells.Add(thc1);
thc1.Text = "Start Date";
thr.Cells.Add(thc2);
thc2.Text = "End Date";
thr.Cells.Add(thc3);
thc3.Text = "Assignee";
TableSearchResults.Rows.Add(thr);
foreach (string li in results)
{
TableRow tr = new TableRow();
string[] str = li.Split('+');
TableCell tc = new TableCell();
TableCell tc1 = new TableCell();
TableCell tc2 = new TableCell();
TableCell tc3 = new TableCell();
tc.Text = str[0];
tc1.Text = str[1];
tc2.Text = str[2];
tc3.Text = str[3];
tr.Cells.Add(tc);
tr.Cells.Add(tc1);
tr.Cells.Add(tc2);
tr.Cells.Add(tc3);
TableSearchResults.Rows.Add(tr);
}
}
示例13: AddHeaderRow
public static void AddHeaderRow(this Table table, int cellCount, string header)
{
TableRow row = new TableRow();
TableHeaderCell cell = new TableHeaderCell();
cell.ColumnSpan = cellCount;
cell.HorizontalAlign = HorizontalAlign.Left;
cell.Text = header;
row.Cells.Add(cell);
table.Rows.Add(row);
}
示例14: btnAddFoodItemToShoppingList_Click
protected void btnAddFoodItemToShoppingList_Click(object sender, EventArgs e)
{
double num;
string amount = txtAmount.Text;
bool isNum = Double.TryParse(amount, out num);
if (amount != "")
{
if (isNum)
{
lbFoodItemID.Items.Add(ddlFoodItem.SelectedValue);
lbFoodItemID.Items[lbFoodItemID.Items.Count - 1].Value = txtAmount.Text;
tbFoodItem.Rows.Clear();
TableHeaderRow tbHeaderRow = new TableHeaderRow();
tbFoodItem.Rows.Add(tbHeaderRow);
TableHeaderCell tbHeaderCellName = new TableHeaderCell();
TableHeaderCell tbHeaderCellAmount = new TableHeaderCell();
tbHeaderCellName.Text = "Name";
tbHeaderCellAmount.Text = "Amount";
tbHeaderRow.Cells.Add(tbHeaderCellName);
tbHeaderRow.Cells.Add(tbHeaderCellAmount);
for (int k = 0; k < lbFoodItemID.Items.Count; k++)
{
string foodid = lbFoodItemID.Items[k].Text;
OleDbCommand command = new OleDbCommand("SELECT * FROM FoodItem WHERE FoodItemID = " + foodid.ToString(), myConnection);
command.CommandType = CommandType.Text;
OleDbDataReader reader = command.ExecuteReader();
bool notEoF = reader.Read();
while (notEoF)
{
TableRow tbRow = new TableRow();
tbFoodItem.Rows.Add(tbRow);
TableCell tbCellName = new TableCell();
TableCell tbCellAmount = new TableCell();
tbCellName.Text = reader["Name"].ToString();
tbCellAmount.Text = lbFoodItemID.Items[k].Value + " " + reader["UnitType"].ToString();
tbRow.Cells.Add(tbCellName);
tbRow.Cells.Add(tbCellAmount);
notEoF = reader.Read();
}
reader.Close();
}
}
else
{
lblAmount.Text = "Amount is Invalid";
}
}
else
{
lblAmount.Text = "Amount Required";
}
}
示例15: fillContact
protected void fillContact()
{
TableRow headerRow = new TableRow();
TableRow valuesRow = new TableRow();
TableHeaderCell address1Header = new TableHeaderCell();
TableHeaderCell address2Header = new TableHeaderCell();
TableHeaderCell cityHeader = new TableHeaderCell();
TableHeaderCell stateHeader = new TableHeaderCell();
TableHeaderCell zipHeader = new TableHeaderCell();
TableHeaderCell phoneHeader = new TableHeaderCell();
TableCell address1 = new TableCell();
TableCell address2 = new TableCell();
TableCell city = new TableCell();
TableCell status = new TableCell();
TableCell zipcode = new TableCell();
TableCell phone = new TableCell();
address1Header.Text = "Address 1".ToUpper();
address2Header.Text = "Address 2".ToUpper();
cityHeader.Text = "City".ToUpper();
stateHeader.Text = "State".ToUpper();
zipHeader.Text = "Zip Code".ToUpper();
phoneHeader.Text = "Phone".ToUpper();
address1.Text = employee.Address.Address1;
address2.Text = employee.Address.Address2;
city.Text = employee.Address.City;
status.Text = employee.Address.State;
zipcode.Text = employee.Address.ZipCode.ToString();
phone.Text = employee.Phone;
headerRow.Cells.Add(address1Header);
headerRow.Cells.Add(address2Header);
headerRow.Cells.Add(cityHeader);
headerRow.Cells.Add(stateHeader);
headerRow.Cells.Add(zipHeader);
headerRow.Cells.Add(phoneHeader);
valuesRow.Cells.Add(address1);
valuesRow.Cells.Add(address2);
valuesRow.Cells.Add(city);
valuesRow.Cells.Add(status);
valuesRow.Cells.Add(zipcode);
valuesRow.Cells.Add(phone);
AddressTable.Rows.Add(headerRow);
AddressTable.Rows.Add(valuesRow);
AddressTable.CssClass = "table";
}