本文整理汇总了C#中System.Web.UI.WebControls.TableHeaderRow类的典型用法代码示例。如果您正苦于以下问题:C# TableHeaderRow类的具体用法?C# TableHeaderRow怎么用?C# TableHeaderRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableHeaderRow类属于System.Web.UI.WebControls命名空间,在下文中一共展示了TableHeaderRow类的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: CreateHeaderRow
private void CreateHeaderRow()
{
TableHeaderRow headerRow = new TableHeaderRow { CssClass = "titles" };
headerRow.Cells.Add(new TableHeaderCell { Text = "Visitor Language" });
headerRow.Cells.Add(new TableHeaderCell { Text = "Fallback Language" });
tblFallbackLanguages.Rows.Add(headerRow);
}
示例3: BuildFieldDescTable
public static Table BuildFieldDescTable(IEnumerable<Tuple<string, string>> dataRows)
{
Table table = new Table();
TableHeaderRow thr = new TableHeaderRow();
TableCell hc1 = new TableCell();
TableCell hc2 = new TableCell();
hc1.Text = "Field";
hc2.Text = "Description";
thr.Cells.Add(hc1);
thr.Cells.Add(hc2);
foreach (Tuple<string, string> dataRow in dataRows)
{
TableRow r = new TableRow();
TableCell c1 = new TableCell();
TableCell c2 = new TableCell();
c1.Text = dataRow.Item1;
c2.Text = dataRow.Item2;
r.Cells.Add(c1);
r.Cells.Add(c2);
table.Rows.Add(r);
}
return table;
}
示例4: 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);
}
示例5: 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");
}
示例6: 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;
}
}
示例7: 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);
}
}
示例8: displayResults
private void displayResults()
{
if (Session["recallList"] == null)
{
Response.Redirect("Home.asp"); // Session Timeout
}
// Get the search results...
List<RecallFoodAlertData> recallList = (List<RecallFoodAlertData>)Session["recallList"];
recallList = recallList.OrderBy(t => t.Classification).ThenByDescending(t => t.ReportDate).ToList<RecallFoodAlertData>();
// Build the table rows and display the results
TableHeaderRow thr = new TableHeaderRow();
System.Text.StringBuilder resultsHTML = new System.Text.StringBuilder();
resultsDiv.InnerHtml = "No results found";
foreach (RecallFoodAlertData rfad in recallList)
{
string imageUrl = "";
switch (rfad.Classification.ToUpper())
{
case "CLASS I":
imageUrl = "img/risk-high.png";
break;
case "CLASS II":
imageUrl = "img/risk-med.png";
break;
case "CLASS III":
imageUrl = "img/risk-low.png";
break;
default:
imageUrl = "img/No-Data.png";
break;
}
resultsHTML.Append("<div class='search-result-container large-12 medium-12 small-12 columns'>");
resultsHTML.Append("<div class='search-result-box box'>");
string hrefUrl = string.Format("Details.aspx?recall={0}", rfad.RecallNumber);
resultsHTML.Append("<h3><a href='" + hrefUrl + "'>" + rfad.FirmName + "</a></h3>");
resultsHTML.Append("<div class='search-result-details large-11 medium-11 small-9 columns'>");
resultsHTML.Append("<h4>Initiation Date: " + rfad.InitiationDate.ToString("MM/dd/yyyy") + "</h4>");
resultsHTML.Append("<p>" + rfad.ProductDescription + "</p>");
resultsHTML.Append("</div>");
resultsHTML.Append("<div class='no-pad-right large-1 medium-1 small-3 columns'>");
resultsHTML.Append("<img class='risk-level right' src='" + imageUrl + "' />");
resultsHTML.Append("</div></div></div>");
}
if (resultsHTML.Length > 0)
{
resultsDiv.InnerHtml = resultsHTML.ToString();
}
}
示例9: 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";
}
}
示例10: RenderTable
protected void RenderTable(bool CelciusToFahrenheit, int startValue, int endValue, int stepValue)
{
//skapar tableheader
var thCell1 = new TableHeaderCell();
var thCell2 = new TableHeaderCell();
if (CelciusToFahrenheit)
{
thCell1.Controls.Add(new LiteralControl("°C"));
thCell2.Controls.Add(new LiteralControl("°F"));
}
else
{
thCell1.Controls.Add(new LiteralControl("°F"));
thCell2.Controls.Add(new LiteralControl("°C"));
}
var thRow = new TableHeaderRow();
thRow.Controls.Add(thCell1);
thRow.Controls.Add(thCell2);
tblResults.Controls.Add(thRow);
//skapar tablebody
while (startValue <= endValue)
{
var row = new TableRow();
var cell = new TableCell();
cell.Controls.Add(
new LiteralControl(
startValue.ToString()));
row.Controls.Add(cell);
cell = new TableCell();
if (CelciusToFahrenheit)
{
cell.Controls.Add(
new LiteralControl(
TemperatureConverter.CelciusToFahrenheit(startValue).ToString()));
}
else
{
cell.Controls.Add(
new LiteralControl(
TemperatureConverter.FahrenheitToCelcius(startValue).ToString()));
}
row.Controls.Add(cell);
tblResults.Rows.Add(row);
startValue += stepValue;
}
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
using (var conn = new SqlConnection("Server=(local);DataBase=Nutrition;Integrated Security=SSPI"))
{
using (var command = new SqlCommand("dbo.Food_Nutrition_Get", conn)
{
CommandType = CommandType.StoredProcedure
})
{
conn.Open();
var reader = command.ExecuteReader(CommandBehavior.CloseConnection);
if (reader.HasRows)
{
TableHeaderRow header = new TableHeaderRow();
header.Cells.Add(new TableHeaderCell { Text = "Food Name" });
header.Cells.Add(new TableHeaderCell { Text = "Calories" });
header.Cells.Add(new TableHeaderCell { Text = "Water" });
header.Cells.Add(new TableHeaderCell { Text = "Protein" });
header.Cells.Add(new TableHeaderCell { Text = "Lipid" });
header.Cells.Add(new TableHeaderCell { Text = "Carbohydrate" });
header.Cells.Add(new TableHeaderCell { Text = "Fiber" });
header.Cells.Add(new TableHeaderCell { Text = "Sugar" });
header.Cells.Add(new TableHeaderCell { Text = "Calcium" });
header.Cells.Add(new TableHeaderCell { Text = "Iron" });
header.TableSection = TableRowSection.TableHeader;
this.domainsTable.Rows.Add(header);
TableRow tr;
while (reader.Read())
{
tr = new TableRow();
tr.Attributes.Add("onclick", "SelectFood(this);");
tr.Attributes.Add("foodkey", reader["Food_Key"].ToString());
tr.Attributes.Add("foodunitkey", reader["Food_Unit_Key"].ToString());
tr.Attributes.Add("foodname", reader["Name"].ToString());
tr.Cells.Add(new TableCell { Text = reader["Name"].ToString() });
tr.Cells.Add(new TableCell { Text = reader["Calories"].ToString(), CssClass = "Number" });
tr.Cells.Add(new TableCell { Text = reader["Water"].ToString(), CssClass = "Number" });
tr.Cells.Add(new TableCell { Text = reader["Protein"].ToString(), CssClass = "Number" });
tr.Cells.Add(new TableCell { Text = reader["Lipid"].ToString(), CssClass = "Number" });
tr.Cells.Add(new TableCell { Text = reader["Carbohydrate"].ToString(), CssClass = "Number" });
tr.Cells.Add(new TableCell { Text = reader["Fiber"].ToString(), CssClass = "Number" });
tr.Cells.Add(new TableCell { Text = reader["Sugar"].ToString(), CssClass = "Number" });
tr.Cells.Add(new TableCell { Text = reader["Calcium"].ToString(), CssClass = "Number" });
tr.Cells.Add(new TableCell { Text = reader["Iron"].ToString(), CssClass = "Number" });
this.domainsTable.Rows.Add(tr);
}
}
conn.Close();
}
}
}
示例12: initTable
/// <summary>
/// Init the table to view informations
/// </summary>
private void initTable()
{
TableHeaderRow header = new TableHeaderRow();
header.CssClass = "tableAlternateHeader";
InscriptionsTable.Controls.Add(header);
TableCell hProjects = new TableCell();
hProjects.Text = "Projets";
header.Controls.Add(hProjects);
TableCell hStudents = new TableCell();
hStudents.Text = "Etudiant inscrits";
header.Controls.Add(hStudents);
}
示例13: CreateHeaderRow
private void CreateHeaderRow(Table table)
{
using (TableHeaderRow header = new TableHeaderRow())
{
header.TableSection = TableRowSection.TableHeader;
this.AddHeaderCell(header, "340px", Titles.Comment);
this.AddHeaderCell(header, "50px", Titles.Upload, "nopadding");
this.AddHeaderCell(header, "240px", Titles.Progress);
this.AddHeaderCell(header, "", Titles.FilePath);
table.Rows.Add(header);
}
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Ado.ClasesComunes.Periodo _periodoActual = new Ado.ClasesComunes.Periodo();
IMetodosAdministrador _metAdministrador = new MetodosAdministrador();
_periodoActual = _metAdministrador.UltimoPeriodo();
if (_periodoActual != null)
{
LinkedList<string> _encabezados = new LinkedList<string>();
_encabezados.AddLast("Identificación");
_encabezados.AddLast("Fecha de Inicio");
_encabezados.AddLast("Fecha de Fin");
_encabezados.AddLast("Estado");
_encabezados.AddLast("Modalidad");
_encabezados.AddLast("Año");
_encabezados.AddLast("Número de Periodo");
TableHeaderRow _encabezado = new TableHeaderRow();
foreach (var _elemento in _encabezados)
{
TableHeaderCell _celda = new TableHeaderCell();
_celda.Text = _elemento;
_encabezado.Cells.Add(_celda);
}
LinkedList<string> _periodo = new LinkedList<string>();
_periodo.AddLast(_periodoActual.Id_Periodo.ToString());
_periodo.AddLast(_periodoActual.Fec_Inicio.Date.ToString());
_periodo.AddLast(_periodoActual.Fec_Fin.Date.ToString());
_periodo.AddLast(_periodoActual.Txt_Estado);
_periodo.AddLast(_periodoActual.Txt_Modalidad);
_periodo.AddLast(_periodoActual.Num_Anno.ToString());
_periodo.AddLast(_periodoActual.Num_Periodo.ToString());
TableRow _fila = new TableRow();
foreach (var _elemento in _periodo)
{
TableCell _celda = new TableCell();
_celda.Text = _elemento;
_fila.Cells.Add(_celda);
}
//Lleno tabla
tblPeriodo.Rows.Add(_encabezado);
tblPeriodo.Rows.Add(_fila);
}
else
{
//Agrego Label que diga que no hay un periodo de recepcion en curso actualmente.
lblSinPeriodo.Text = "-- El sistema no tiene actualmente un periodo de recepción de solicitudes en curso actualmente. --";
}
}
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
int shoppingListID = 0;
if (Request.QueryString["ShoppingListID"] != null && Request.QueryString["ShoppingListID"] != "")
{
shoppingListID = Convert.ToInt32(Request.QueryString["ShoppingListID"]);
}
else
{
Response.Redirect("ShoppingListHistory.aspx");
}
myConnection.ConnectionString = connstr;
myConnection.Open();
OleDbCommand cmd = new OleDbCommand("SELECT * FROM ShoppingList WHERE ShoppingListID = " + shoppingListID, myConnection);
cmd.CommandType = CommandType.Text;
OleDbDataReader reader = cmd.ExecuteReader();
bool notEoF = reader.Read();
while (notEoF)
{
lblCreatedDate.Text = reader["CreatedDate"].ToString().Split(' ')[0].ToString();
notEoF = reader.Read();
}
reader.Close();
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);
OleDbCommand cmd2 = new OleDbCommand("SELECT * FROM FoodItem AS f INNER JOIN ShoppingListFoodItem AS sf ON f.FoodItemID = sf.FoodItemID WHERE sf.ShoppingListID = " + shoppingListID, myConnection);
cmd2.CommandType = CommandType.Text;
OleDbDataReader reader2 = cmd2.ExecuteReader();
bool notEoF2 = reader2.Read();
while (notEoF2)
{
TableRow tbRow = new TableRow();
tbFoodItem.Rows.Add(tbRow);
TableCell tbCellName = new TableCell();
TableCell tbCellAmount = new TableCell();
tbCellName.Text = reader2["Name"].ToString();
tbCellAmount.Text = reader2["Amount"].ToString() + " " + reader2["UnitType"].ToString();
tbRow.Cells.Add(tbCellName);
tbRow.Cells.Add(tbCellAmount);
notEoF2 = reader2.Read();
}
reader2.Close();
}