本文整理汇总了C#中System.Web.UI.HtmlControls.HtmlTable类的典型用法代码示例。如果您正苦于以下问题:C# HtmlTable类的具体用法?C# HtmlTable怎么用?C# HtmlTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlTable类属于System.Web.UI.HtmlControls命名空间,在下文中一共展示了HtmlTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
HtmlTable table1 = new HtmlTable();
table1.Border = 1;
table1.CellPadding = 3;
table1.CellSpacing = 3;
table1.BorderColor = "red";
HtmlTableRow row;
HtmlTableCell cell;
for (int i = 1; i <= 5; i++)
{
row = new HtmlTableRow();
row.BgColor = (i % 2 == 0 ? "lightyellow" : "lightcyan");
for (int j = 1; j <= 4; j++)
{
cell = new HtmlTableCell();
cell.InnerHtml = "Row: " + i.ToString() + "<br /> Cell: " + j.ToString();
row.Cells.Add(cell);
}
table1.Rows.Add(row);
}
this.Controls.Add(table1);
}
示例2: AddNumberTextBox
public static void AddNumberTextBox(HtmlTable t, string columnName, string defaultValue, bool isSerial, bool isNullable, int maxLength, string domain)
{
TextBox textBox = GetNumberTextBox(columnName + "_textbox", maxLength);
string label = MixERP.Net.Common.Helpers.LocalizationHelper.GetResourceString("FormResource", columnName);
if(!defaultValue.StartsWith("nextVal", StringComparison.OrdinalIgnoreCase))
{
textBox.Text = defaultValue;
}
textBox.Width = 200;
if(isSerial)
{
textBox.ReadOnly = true;
}
else
{
if(!isNullable)
{
CompareValidator validator = GetNumberValidator(textBox, domain);
RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox);
ScrudFactoryHelper.AddRow(t, label + Resources.ScrudResource.RequiredFieldIndicator, textBox, validator, required);
return;
}
}
ScrudFactoryHelper.AddRow(t, label, textBox);
}
示例3: AddRadioButtonList
public static void AddRadioButtonList(HtmlTable htmlTable, string resourceClassName, string columnName,
bool isNullable, string keys, string values, string selectedValue, string errorCssClass)
{
if (htmlTable == null)
{
return;
}
using (
var radioButtonList = GetRadioButtonList(columnName + "_radiobuttonlist", keys, values, selectedValue))
{
var label = LocalizationHelper.GetResourceString(resourceClassName, columnName);
if (!isNullable)
{
using (var required = ScrudFactoryHelper.GetRequiredFieldValidator(radioButtonList, errorCssClass))
{
ScrudFactoryHelper.AddRow(htmlTable, label + ScrudResource.RequiredFieldIndicator,
radioButtonList, required);
return;
}
}
ScrudFactoryHelper.AddRow(htmlTable, label, radioButtonList);
}
}
示例4: btnLiteralTable_Click
protected void btnLiteralTable_Click(object sender, EventArgs e)
{
System.Web.UI.HtmlControls.HtmlTable tableT = new System.Web.UI.HtmlControls.HtmlTable();
System.Web.UI.HtmlControls.HtmlTableRow rowR = new System.Web.UI.HtmlControls.HtmlTableRow();
System.Web.UI.HtmlControls.HtmlTableCell cellA = new System.Web.UI.HtmlControls.HtmlTableCell();
System.Web.UI.HtmlControls.HtmlTableCell cellB = new System.Web.UI.HtmlControls.HtmlTableCell();
System.Web.UI.HtmlControls.HtmlTableCell cellC = new System.Web.UI.HtmlControls.HtmlTableCell();
cellA.InnerText = "t2 C1Header";
cellB.InnerText = "t2 C2Header";
cellC.InnerText = "t2 C3Header";
rowR.Cells.Add(cellA);
rowR.Cells.Add(cellB);
rowR.Cells.Add(cellC);
tableT.Rows.Add(rowR);
cellA = new HtmlTableCell();
cellB = new HtmlTableCell();
cellC = new HtmlTableCell();
rowR = new HtmlTableRow();
cellA.InnerText = "r1c1";
cellB.InnerHtml = "r2c2";
cellC.InnerText = "r3c3";
rowR.Cells.Add(cellA);
rowR.Cells.Add(cellB);
rowR.Cells.Add(cellC);
tableT.Rows.Add(rowR);
this.Controls.Add(tableT);
}
示例5: AddDropDownList
public static void AddDropDownList(HtmlTable htmlTable, string columnName, bool isNullable, string tableSchema, string tableName, string tableColumn, string defaultValue, string displayFields, string displayViews, string selectedValues)
{
string label = LocalizationHelper.GetResourceString("FormResource", columnName);
DropDownList dropDownList = GetDropDownList(columnName + "_dropdownlist");
HtmlAnchor itemSelectorAnchor;
using (System.Data.DataTable table = MixERP.Net.WebControls.ScrudFactory.Data.FormHelper.GetTable(tableSchema, tableName))
{
SetDisplayFields(dropDownList, table, tableSchema, tableName, tableColumn, displayFields);
itemSelectorAnchor = GetItemSelector(dropDownList.ClientID, table, tableSchema, tableName, tableColumn, displayViews);
}
SetSelectedValue(dropDownList, tableSchema, tableName, tableColumn, defaultValue, selectedValues);
if (isNullable)
{
dropDownList.Items.Insert(0, new ListItem(String.Empty, String.Empty));
ScrudFactoryHelper.AddRow(htmlTable, label, dropDownList, itemSelectorAnchor);
}
else
{
RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(dropDownList);
ScrudFactoryHelper.AddRow(htmlTable, label + Resources.ScrudResource.RequiredFieldIndicator, dropDownList, required, itemSelectorAnchor);
}
}
示例6: AddTo
public override Control AddTo(Control container)
{
HtmlTableCell labelCell = new HtmlTableCell();
Label label = AddLabel(labelCell);
HtmlTableCell editorCell = new HtmlTableCell();
Control editor = AddEditor(editorCell);
if (label != null && editor != null && !string.IsNullOrEmpty(editor.ID))
label.AssociatedControlID = editor.ID;
HtmlTableCell extraCell = new HtmlTableCell();
if (Required)
AddRequiredFieldValidator(extraCell, editor);
if (Validate)
AddRegularExpressionValidator(extraCell, editor);
AddHelp(extraCell);
HtmlTableRow row = new HtmlTableRow();
row.Cells.Add(labelCell);
row.Cells.Add(editorCell);
row.Cells.Add(extraCell);
HtmlTable editorTable = new HtmlTable();
editorTable.Attributes["class"] = "editDetail";
editorTable.Controls.Add(row);
container.Controls.Add(editorTable);
return editor;
}
示例7: AddTextBox
public static void AddTextBox(HtmlTable htmlTable, string resourceClassName, string columnName,
string defaultValue, bool isNullable, int maxLength, string errorCssClass)
{
if (htmlTable == null)
{
return;
}
if (string.IsNullOrWhiteSpace(columnName))
{
return;
}
using (var textBox = GetTextBox(columnName + "_textbox", maxLength))
{
var label = LocalizationHelper.GetResourceString(resourceClassName, columnName);
textBox.Text = defaultValue;
if (!isNullable)
{
var required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox, errorCssClass);
ScrudFactoryHelper.AddRow(htmlTable, label + ScrudResource.RequiredFieldIndicator, textBox, required);
return;
}
ScrudFactoryHelper.AddRow(htmlTable, label, textBox);
}
}
示例8: AddTextBox
public static void AddTextBox(HtmlTable htmlTable, string columnName, string defaultValue, bool isNullable, int maxLength)
{
if (htmlTable == null)
{
return;
}
if (string.IsNullOrWhiteSpace(columnName))
{
return;
}
using (TextBox textBox = GetTextBox(columnName + "_textbox", maxLength))
{
string label = MixERP.Net.Common.Helpers.LocalizationHelper.GetResourceString("FormResource", columnName);
textBox.Text = defaultValue;
if (!isNullable)
{
RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox);
ScrudFactoryHelper.AddRow(htmlTable, label + Resources.ScrudResource.RequiredFieldIndicator, textBox, required);
return;
}
ScrudFactoryHelper.AddRow(htmlTable, label, textBox);
}
}
示例9: AddTopFormControls
private void AddTopFormControls(HtmlTable table)
{
using (HtmlTableRow row = new HtmlTableRow())
{
this.AddDateTextBoxCell(row);
if (this.ShowStore)
{
AddStoreSelectCell(row);
}
AddPartyCodeInputTextCell(row);
AddPartySelectCell(row);
if (this.ShowPriceTypes)
{
AddPriceTypeSelectCell(row);
}
this.AddReferenceNumberInputTextCell(row);
this.AddCashTransactionDivCell(row);
this.AddPaymentTermSelectCell(row);
table.Controls.Add(row);
}
}
示例10: AddDateTextBox
public static void AddDateTextBox(HtmlTable t, string columnName, string defaultValue, bool isNullable, int maxLength)
{
string label = MixERP.Net.Common.Helpers.LocalizationHelper.GetResourceString("FormResource", columnName);
TextBox textBox = ScrudTextBox.GetTextBox(columnName + "_textbox", maxLength);
textBox.CssClass = "date";
CompareValidator validator = GetDateValidator(textBox);
AjaxControlToolkit.CalendarExtender extender = new AjaxControlToolkit.CalendarExtender();
textBox.Width = 70;
extender.ID = textBox.ID + "_calendar_extender";
extender.TargetControlID = textBox.ID;
extender.PopupButtonID = textBox.ID;
if(!string.IsNullOrWhiteSpace(defaultValue))
{
textBox.Text = MixERP.Net.Common.Conversion.TryCastDate(defaultValue).ToShortDateString();
}
if(!isNullable)
{
RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox);
ScrudFactoryHelper.AddRow(t, label + Resources.ScrudResource.RequiredFieldIndicator, textBox, validator, required, extender);
return;
}
ScrudFactoryHelper.AddRow(t, label, textBox, validator, extender);
}
示例11: AddDropDownList
public static void AddDropDownList(HtmlTable htmlTable, string resourceClassName, string itemSelectorPath,
string columnName, bool isNullable, string tableSchema, string tableName, string tableColumn,
string defaultValue, string displayFields, string displayViews, bool useDisplayViewsAsParent,
string selectedValues, string errorCssClass)
{
var label = LocalizationHelper.GetResourceString(resourceClassName, columnName);
var dropDownList = GetDropDownList(columnName + "_dropdownlist");
HtmlAnchor itemSelectorAnchor;
using (var table = GetTable(tableSchema, tableName, tableColumn, displayViews, useDisplayViewsAsParent))
{
SetDisplayFields(dropDownList, table, tableSchema, tableName, tableColumn, displayFields);
itemSelectorAnchor = GetItemSelector(dropDownList.ClientID, table, itemSelectorPath, tableSchema,
tableName, tableColumn, displayViews);
}
SetSelectedValue(dropDownList, tableSchema, tableName, tableColumn, defaultValue, selectedValues);
if (isNullable)
{
dropDownList.Items.Insert(0, new ListItem(String.Empty, String.Empty));
ScrudFactoryHelper.AddDropDownList(htmlTable, label, dropDownList, itemSelectorAnchor, null);
}
else
{
var required = ScrudFactoryHelper.GetRequiredFieldValidator(dropDownList, errorCssClass);
ScrudFactoryHelper.AddDropDownList(htmlTable, label + ScrudResource.RequiredFieldIndicator, dropDownList,
itemSelectorAnchor, required);
}
}
示例12: AddDecimalTextBox
internal static void AddDecimalTextBox(HtmlTable htmlTable, string resourceClassName, string columnName, string label, string description,
string defaultValue, bool isNullable, int maxLength, string domain, string errorCssClass, bool disabled)
{
using (TextBox textBox = ScrudTextBox.GetTextBox(columnName + "_textbox", maxLength))
{
if (string.IsNullOrWhiteSpace(label))
{
label = ScrudLocalizationHelper.GetResourceString(resourceClassName, columnName);
}
using (CompareValidator validator = GetDecimalValidator(textBox, domain, errorCssClass))
{
textBox.Text = defaultValue;
textBox.ReadOnly = disabled;
textBox.CssClass = "decimal";
if (!string.IsNullOrWhiteSpace(description))
{
textBox.CssClass += " activating element";
textBox.Attributes.Add("data-content", description);
}
if (!isNullable)
{
RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox,
errorCssClass);
ScrudFactoryHelper.AddRow(htmlTable, label + Titles.RequiredFieldIndicator, textBox, validator,
required);
return;
}
ScrudFactoryHelper.AddRow(htmlTable, label, textBox, validator);
}
}
}
示例13: ASPXToPDF
public void ASPXToPDF(HtmlTable objhtml1, HtmlTable objhtml2)
{
string fileName = "AsignacionFolios.pdf";
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.Clear();
StringWriter sw1 = new StringWriter();
HtmlTextWriter hw1 = new HtmlTextWriter(sw1);
objhtml1.RenderControl(hw1);
StringWriter sw2 = new StringWriter();
HtmlTextWriter hw2 = new HtmlTextWriter(sw2);
objhtml2.RenderControl(hw2);
StringReader sr1 = new StringReader(sw1.ToString());
StringReader sr2 = new StringReader(sw2.ToString());
Document pdfDoc = new Document(PageSize.A2, 5f, 5f, 5f, 5f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, HttpContext.Current.Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr1);
pdfDoc.NewPage();
htmlparser.Parse(sr2);
pdfDoc.Close();
HttpContext.Current.Response.ContentType = "application/pdf";
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Write(pdfDoc);
HttpContext.Current.Response.End();
}
示例14: AddRadioButtonList
internal static void AddRadioButtonList(HtmlTable htmlTable, string resourceClassName, string columnName, bool isNullable, string keys, string values, string selectedValue, string errorCssClass, bool disabled)
{
if (htmlTable == null)
{
return;
}
using (RadioButtonList radioButtonList = GetRadioButtonList(columnName + "_radiobuttonlist", keys, values, selectedValue))
{
string label = ScrudLocalizationHelper.GetResourceString(resourceClassName, columnName);
radioButtonList.Enabled = !disabled;
if (!isNullable)
{
using (RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(radioButtonList, errorCssClass))
{
ScrudFactoryHelper.AddRow(htmlTable, label + Titles.RequiredFieldIndicator, radioButtonList, required);
return;
}
}
ScrudFactoryHelper.AddRow(htmlTable, label, radioButtonList);
}
}
示例15: GetAddressInfoTab
private HtmlGenericControl GetAddressInfoTab()
{
using (HtmlGenericControl addressInfoDiv = ControlHelper.GetGenericControl(@"div", @"ui tab bottom stacked attached teal segment"))
{
addressInfoDiv.Attributes.Add("data-tab", "contact-info");
addressInfoDiv.ID = "addresses-and-contact-info";
using (HtmlGenericControl h3 = ControlHelper.GetGenericControl("h3", "ui header"))
{
h3.InnerHtml = " <i class='globe icon'></i>" + Titles.AddressAndContactInfo;
addressInfoDiv.Controls.Add(h3);
}
using (HtmlTable table = new HtmlTable())
{
table.Attributes.Add("class", "ui table segment");
table.Rows.Add(ControlHelper.GetNewRow(Titles.DefaultAddress, @"AddressDiv", "div"));
table.Rows.Add(ControlHelper.GetNewRow(Titles.ShippingAddresses, @"ShippingAddressesDiv", "div"));
addressInfoDiv.Controls.Add(table);
}
return addressInfoDiv;
}
}