本文整理汇总了C#中System.Web.UI.WebControls.TableHeaderCell类的典型用法代码示例。如果您正苦于以下问题:C# TableHeaderCell类的具体用法?C# TableHeaderCell怎么用?C# TableHeaderCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableHeaderCell类属于System.Web.UI.WebControls命名空间,在下文中一共展示了TableHeaderCell类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:known,项目名称:Known,代码行数:34,代码来源:GridViewExtension.cs
示例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);
}
}
开发者ID:OAT-TUU-TANG-FIRST,项目名称:RMUTTO,代码行数:30,代码来源:INS-Result.aspx.cs
示例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";
}
开发者ID:hlj1013,项目名称:HR-System,代码行数:30,代码来源:EmployeeView.aspx.cs
示例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);
}
}
开发者ID:rgarbi,项目名称:RosedalePhoneLog,代码行数:28,代码来源:CallTypeResultsPage.aspx.cs
示例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);
}
开发者ID:KasperFlye,项目名称:CsharpAndDotNet,代码行数:35,代码来源:Default.aspx.cs
示例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;
}
}
开发者ID:JonathanValle,项目名称:mixerp,代码行数:33,代码来源:GridPanel.cs
示例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();
}
开发者ID:nobled,项目名称:mono,代码行数:28,代码来源:TableHeaderCell_ctor_.aspx.cs
示例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;
}
开发者ID:redtchits,项目名称:RCM,代码行数:28,代码来源:MakeProjections.aspx.cs
示例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");
}
开发者ID:vm-aorcasitas,项目名称:C8-Ux2CampaignSystem,代码行数:33,代码来源:EditorMain.aspx.cs
示例10: AddHeaderCell
private static TableCell AddHeaderCell(TableRow trow, string text)
{
TableHeaderCell cell = new TableHeaderCell {
Text = text
};
trow.Cells.Add(cell);
return cell;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:TraceHandler.cs
示例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;
}
}
开发者ID:re222dv,项目名称:vt14-1-3-konvertera-temperaturer,代码行数:54,代码来源:Default.aspx.cs
示例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);
}
}
开发者ID:NghiemTrung,项目名称:kanbean,代码行数:54,代码来源:SearchResults.aspx.cs
示例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);
}
开发者ID:dbrgn,项目名称:pi-vote,代码行数:12,代码来源:TableExtensions.cs
示例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";
}
}
开发者ID:trinhphandinhhuy,项目名称:FoodApp,代码行数:52,代码来源:AddShoppingList.aspx.cs
示例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";
}
开发者ID:hlj1013,项目名称:HR-System,代码行数:52,代码来源:EmployeeView.aspx.cs
示例16: 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;
}
}
开发者ID:hl222ih,项目名称:1dv406,代码行数:51,代码来源:Default.aspx.cs
示例17: OnDataBound
protected void OnDataBound(object sender, EventArgs e)
{
GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
for (int i = 0; i < GridView1.Columns.Count; i++)
{
TableHeaderCell cell = new TableHeaderCell();
TextBox txtSearch = new TextBox();
txtSearch.Attributes["placeholder"] = GridView1.Columns[i].HeaderText;
txtSearch.CssClass = "search_textbox";
cell.Controls.Add(txtSearch);
row.Controls.Add(cell);
}
GridView1.HeaderRow.Parent.Controls.AddAt(1, row);
}
开发者ID:JobFair,项目名称:JobFairRepo,代码行数:14,代码来源:searchRecord.ascx.cs
示例18: 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. --";
}
}
开发者ID:jascrer,项目名称:Sistema_de_Inclusiones_IC-ITCR,代码行数:49,代码来源:ConsultaPeriodo.aspx.cs
示例19: 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();
}
开发者ID:trinhphandinhhuy,项目名称:FoodApp,代码行数:49,代码来源:ViewSPList.aspx.cs
示例20: gridViewDetail_RowCreated
protected void gridViewDetail_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
GridViewRow gvr = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
TableHeaderCell thc = new TableHeaderCell();
thc.ColumnSpan = 4;
thc.Text = "General Info";
//thc.BackColor = System.Drawing.Color.Yellow;
gvr.Cells.Add(thc);
System.Drawing.Color backcolor = System.Drawing.ColorTranslator.FromHtml("#164BDB");
System.Drawing.Color forecolor = System.Drawing.Color.White;
Department dept = new Department();
JobTypeDepartment jobtypeDepartment = new JobTypeDepartment();
//var departments = dept.GetJobOverviewDepartment();
int rowIndex = 4;
for (int i = 0; i < joboverviewDepartment.Count; i++)
{
if (i % 2 != 0)
{
backcolor = System.Drawing.ColorTranslator.FromHtml("#0D72FF");
//forecolor = System.Drawing.ColorTranslator.FromHtml("#2e6e9e");
forecolor = System.Drawing.Color.White;
}
else
{
backcolor = System.Drawing.ColorTranslator.FromHtml("#164BDB");
forecolor = System.Drawing.Color.White;
}
//var jobtypes = jobtypeDepartment.GetJobOverviewJobType(joboverviewDepartment[i].Id);
if (joboverviewJobType[i].Count > 0)
{
thc = new TableHeaderCell();
thc.BackColor = backcolor;
thc.ForeColor = forecolor;
thc.ColumnSpan = joboverviewJobType[i].Count;
thc.Text = joboverviewDepartment[i].Description;
gvr.Cells.Add(thc);
}
for (int x = 0; x < joboverviewJobType[i].Count; x++)
{
e.Row.Cells[rowIndex].BackColor = backcolor;
e.Row.Cells[rowIndex].ForeColor = forecolor;
rowIndex++;
}
}
gridViewDetail.Controls[0].Controls.AddAt(0, gvr);
}
}
开发者ID:ECTProgrammer,项目名称:ECTSampleRepository,代码行数:49,代码来源:JobOverview.aspx.cs
注:本文中的System.Web.UI.WebControls.TableHeaderCell类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论