本文整理汇总了C#中System.Web.UI.HtmlControls.HtmlGenericControl类的典型用法代码示例。如果您正苦于以下问题:C# HtmlGenericControl类的具体用法?C# HtmlGenericControl怎么用?C# HtmlGenericControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlGenericControl类属于System.Web.UI.HtmlControls命名空间,在下文中一共展示了HtmlGenericControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSalesTypeField
private void AddSalesTypeField(HtmlGenericControl container)
{
using (HtmlGenericControl salesTypeDiv = HtmlControlHelper.GetField())
{
salesTypeDiv.ID = "SalesTypeDiv";
salesTypeDiv.Attributes.Add("style", "width:200px");
using (HtmlGenericControl field = HtmlControlHelper.GetField())
{
using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.SalesType, "SalesTypeSelect"))
{
field.Controls.Add(label);
}
using (HtmlSelect salesTypeSelect = new HtmlSelect())
{
salesTypeSelect.ID = "SalesTypeSelect";
salesTypeSelect.DataSource = this.GetSalesTypes();
salesTypeSelect.DataTextField = "Text";
salesTypeSelect.DataValueField = "Value";
salesTypeSelect.DataBind();
field.Controls.Add(salesTypeSelect);
}
salesTypeDiv.Controls.Add(field);
}
container.Controls.Add(salesTypeDiv);
}
}
示例2: GetAdministrateControls
/// <summary>
/// Adds icons to the configuration area of a block instance. Can be overridden to
/// add additionsl icons
/// </summary>
/// <param name="canConfig"></param>
/// <param name="canEdit"></param>
/// <returns></returns>
public override List<Control> GetAdministrateControls( bool canConfig, bool canEdit )
{
List<Control> configControls = new List<Control>();
// add edit icon to config controls if user has edit permission
if ( canConfig || canEdit )
{
LinkButton lbEdit = new LinkButton();
lbEdit.CssClass = "edit";
lbEdit.ToolTip = "Edit HTML";
lbEdit.Click += lbEdit_Click;
configControls.Add( lbEdit );
HtmlGenericControl iEdit = new HtmlGenericControl( "i" );
lbEdit.Controls.Add( iEdit );
lbEdit.CausesValidation = false;
iEdit.Attributes.Add( "class", "fa fa-pencil-square-o" );
// will toggle the block config so they are no longer showing
lbEdit.Attributes["onclick"] = "Rock.admin.pageAdmin.showBlockConfig()";
ScriptManager.GetCurrent( this.Page ).RegisterAsyncPostBackControl( lbEdit );
}
configControls.AddRange( base.GetAdministrateControls( canConfig, canEdit ) );
return configControls;
}
示例3: CreateChildControls
protected override void CreateChildControls()
{
var root = new HtmlGenericControl("div");
root.ID = "_ParentDiv";
root.Attributes.Add("style", "border-style:solid; border-width:1px;");
Controls.Add(root);
}
示例4: createTable
private HtmlGenericControl createTable(string tableName, string[] keys, string[] values)
{
HtmlGenericControl tableGeneral = new HtmlGenericControl("table");
tableGeneral.Attributes["cellspacing"] = "0";
HtmlGenericControl tableRow = new HtmlGenericControl("tr");
tableRow.Attributes["class"] = "tableTitle";
HtmlGenericControl tableHeader = new HtmlGenericControl("th");
tableHeader.Attributes["colspan"] = "2";
tableHeader.InnerText = tableName;
tableRow.Controls.Add(tableHeader);
tableGeneral.Controls.Add(tableRow);
HtmlGenericControl tr = new HtmlGenericControl("tr");
HtmlGenericControl tdKey = new HtmlGenericControl("td");
HtmlGenericControl tdValue = new HtmlGenericControl("td");
for (int i = 0; i < keys.Length; i++)
{
tr = new HtmlGenericControl("tr");
tdKey = new HtmlGenericControl("td");
tdValue = new HtmlGenericControl("td");
tdKey.InnerText = keys[i];
tdValue.InnerText = values[i];
tr.Controls.Add(tdKey);
tr.Controls.Add(tdValue);
tableGeneral.Controls.Add(tr);
}
return tableGeneral;
}
示例5: AddJavaScriptInclude
/// <summary>
/// файл javascript в header
/// </summary>
public static void AddJavaScriptInclude(string url, Page page)
{
var script = new HtmlGenericControl("script");
script.Attributes["type"] = "text/javascript";
script.Attributes["src"] = url;
page.Header.Controls.Add(script);
}
示例6: CreateNewOptionsToMenuForNavigation
/// <summary>
///
/// </summary>
/// <param name="iChildrenCount"></param>
/// <param name="userLoginName"></param>
/// <param name="ChildrenNodes"></param>
/// <param name="htmlul"></param>
private void CreateNewOptionsToMenuForNavigation(ref Int64 iChildrenCount, string userLoginName, SPNavigationNodeCollection ChildrenNodes,ref HtmlGenericControl htmlul)
{
try
{
HtmlGenericControl htmlh2SubGroup = new HtmlGenericControl("h2");
HtmlGenericControl htmlliSubGroup = new HtmlGenericControl("li");
htmlliSubGroup.Attributes.Add("class", "heading");
htmlh2SubGroup.Controls.Add(CreateAnchor("", ChildrenNodes.Parent.Title, "", "parent"));
htmlliSubGroup.Controls.Add(htmlh2SubGroup);
htmlul.Attributes.Add("class", "simple");
htmlul.Controls.Add(htmlliSubGroup);
foreach (SPNavigationNode node in ChildrenNodes)
{
if (clsCommonBL.IsUserHasAccess(node.Url, userLoginName))
{
HtmlGenericControl htmlli = new HtmlGenericControl("li");
HtmlAnchor htmlAnchor = new HtmlAnchor();
htmlli.Controls.AddAt(0, CreateAnchor(node.Url, node.Title,node.Title, string.Empty));
////Children Count
++iChildrenCount;
htmlul.Controls.Add(htmlli);
}
}
}
catch (Exception ex)
{
throw;
}
}
示例7: CreateChildControls
protected override void CreateChildControls()
{
Table table = new Table();
for (int i = 0; i < _colors.Length; i++)
{
TableRow row = new TableRow();
table.Rows.Add(row);
for (int j = 0; j < _colors[i].Length; j++)
{
TableCell cell = new TableCell();
cell.Style[HtmlTextWriterStyle.Width] = "10px";
cell.Style[HtmlTextWriterStyle.Height] = "10px";
cell.Style[HtmlTextWriterStyle.Cursor] = "pointer";
cell.Style["background-color"] = "#" + _colors[i][j];
cell.Attributes.Add("onclick", "setColor(\"#" + _colors[i][j] + "\")");
row.Cells.Add(cell);
HtmlGenericControl innerDiv = new HtmlGenericControl("div");
innerDiv.Style[HtmlTextWriterStyle.Height] = "100%";
innerDiv.Style[HtmlTextWriterStyle.Width] = "100%";
innerDiv.Style["font-size"] = "1px";
cell.Controls.Add(innerDiv);
}
}
table.Attributes.Add("border", "0");
table.Attributes.Add("cellspacing", "1");
table.Attributes.Add("cellpadding", "0");
table.Style["background-color"] = "#000000";
Content.Add(table);
base.CreateChildControls();
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
const string METHOD_NAME = "Page_Load";
try {
Common.AppHelper.HideWarning(divWarning);
// This is really GREAT !!!
HtmlGenericControl script = new HtmlGenericControl("script");
script.Attributes.Add("type", "text/javascript");
script.Attributes.Add("src", Page.ResolveUrl("~/Script/Common.js"));
Page.Header.Controls.Add(script);
System.Collections.Specialized.NameValueCollection nv = Page.Request.QueryString;
MasterControlName.Text = nv["MasterControlName"];
ActionControlName.Text = nv["ActionControlName"];
Action.Text = nv["Action"];
lblTextEntryLabel.Text = nv["Label"];
string clickCtrl = (nv["clickCtrlName"] != null ? nv["clickCtrlName"].ToString() : "");
btnOk.Attributes.Add("onclick", "DoOk('" + clickCtrl + "');");
}
catch (System.Exception ex) {
Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex);
((PrimaryTemplate)Page.Master).ShowWarning(ex);
}
}
示例9: CreateChildControls
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
base.CreateChildControls();
base.Controls.Clear();
_dfltShowButton = new Button();
base.Controls.Add(_dfltShowButton);
_dfltShowButton.ID = "default";
_dfltShowButton.Attributes.Add("style","display:none");
_dialogPanel = new Panel();
base.Controls.Add( _dialogPanel );
_dialogPanel.ID = "panel";
_dialogPanel.CssClass = "rock-modal-frame";
_dialogPanel.Attributes.Add("style","display:none");
_contentPanel = new Panel();
_dialogPanel.Controls.Add( _contentPanel );
_contentPanel.ID = "contentPanel";
_contentPanel.CssClass = "iframe";
_iFrame = new HtmlGenericControl( "iframe" );
_iFrame.ID = "iframe";
_iFrame.Attributes.Add( "scrolling", "no" );
_contentPanel.Controls.Add( _iFrame );
this.PopupControlID = _dialogPanel.ID;
}
示例10: AddCompactCheckBoxField
private void AddCompactCheckBoxField(HtmlGenericControl container)
{
using (HtmlGenericControl field = HtmlControlHelper.GetField())
{
using (HtmlGenericControl slider = new HtmlGenericControl("div"))
{
slider.Attributes.Add("class", "ui checkbox");
using (HtmlInputCheckBox checkBox = new HtmlInputCheckBox())
{
checkBox.ID = "CompactCheckBox";
checkBox.Checked = false;
slider.Controls.Add(checkBox);
this.isCompactHidden = new HiddenField();
this.isCompactHidden.ID = "IsCompactHidden";
this.isCompactHidden.Value = "0";
slider.Controls.Add(this.isCompactHidden);
}
using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.ShowCompact))
{
slider.Controls.Add(label);
}
field.Controls.Add(slider);
}
container.Controls.Add(field);
}
}
示例11: btnSubmit_Click
protected void btnSubmit_Click(object sender, EventArgs e)
{
string firstNameInput = tbFirstName.Text;
string lastNameInput = tbLastName.Text;
string facultyNumberInput = tbFacultyNumber.Text;
string universitySelection = ddlUniversity.SelectedValue;
string specialtySelection = ddlSpecialty.SelectedValue;
string coursesSelection = ddlCourses.SelectedValue;
var nameHeader = new HtmlGenericControl("h3");
nameHeader.InnerText = String.Format("Name: {0}", System.Web.HttpUtility.HtmlEncode(firstNameInput + " " + lastNameInput));
var facultyNumberHeader = new HtmlGenericControl("h4");
facultyNumberHeader.InnerText = String.Format("Faculty: {0}", System.Web.HttpUtility.HtmlEncode(facultyNumberInput));
var universityHeader = new HtmlGenericControl("h4");
universityHeader.InnerText = String.Format("University: {0}", universitySelection);
var specialtyHeader = new HtmlGenericControl("h4");
specialtyHeader.InnerText = String.Format("Specialty: {0}", specialtySelection);
var coursesHeader = new HtmlGenericControl("h4");
coursesHeader.InnerText = String.Format("Courses: {0}", coursesSelection);
registrationBox.Visible = false;
submittedForm.Controls.Add(nameHeader);
submittedForm.Controls.Add(facultyNumberHeader);
submittedForm.Controls.Add(universityHeader);
submittedForm.Controls.Add(specialtyHeader);
submittedForm.Controls.Add(coursesHeader);
}
示例12: AddAttachmentAnchor
private void AddAttachmentAnchor(HtmlGenericControl h)
{
if (this.DisplayAttachmentButton)
{
if (this.GetTranId().Equals("0"))
{
return;
}
if (string.IsNullOrWhiteSpace(this.AttachmentBookName))
{
return;
}
string overridePath = this.OverridePath;
if (string.IsNullOrWhiteSpace(overridePath))
{
overridePath = PageUtility.GetCurrentPageUrl(this.Page);
}
string attachmentUrl = string.Format(CultureInfo.InvariantCulture, "~/Modules/BackOffice/AttachmentManager.mix?OverridePath={0}&Book={1}&Id={2}", overridePath, this.AttachmentBookName, this.GetTranId());
using (HtmlAnchor anchor = new HtmlAnchor())
{
anchor.ID = "AttachmentAnchor";
anchor.InnerHtml = "<i class='icon cloud upload'></i>" + Titles.UploadAttachmentsForThisTransaction;
anchor.Attributes.Add("class", "item");
anchor.HRef = attachmentUrl;
h.Controls.Add(anchor);
}
}
}
示例13: CreateRotatorNavigationButtons
private void CreateRotatorNavigationButtons(Panel panel, HtmlGenericControl div, int divIndex)
{
panel.Controls.Clear();
double pages = div.Controls[0].Controls[0].Controls.Count / 6.0; //6 is the number of columns
pages = Math.Ceiling(pages);
div.Style["Width"] = (pages * 738) + "px";
if (pages > 1)
{
LinkButton linkButton = CreatePreviousButton(divIndex);
panel.Controls.Add(linkButton);
}
for (int i = 1; i <= pages; i++)
{
LinkButton linkButton = CreateLinkButton(i, divIndex);
panel.Controls.Add(linkButton);
}
if (pages > 1)
{
LinkButton linkButton = CreateNextButton(divIndex);
panel.Controls.Add(linkButton);
}
}
示例14: LoadResults
public void LoadResults(
DataTable dataSource,
Panel panel,
HtmlGenericControl div,
Panel tileResultsPanel,
Panel gridResultsPanel,
RadGrid grid,
string resultType,
string contentTemplate)
{
if (resultType == "Grid")
{
grid.DataSource = dataSource;
grid.DataBind();
tileResultsPanel.Visible = false;
gridResultsPanel.Visible = true;
}
else
{
var resultsControl = new Controls.DynamicTileContainer(4, 113, 525, false);
resultsControl.DataSource = null;
resultsControl.ContentTileTemplate = contentTemplate;
resultsControl.DataSource = dataSource;
resultsControl.DataBind();
tileResultsPanel.Visible = true;
gridResultsPanel.Visible = false;
div.Controls.Clear();
div.Controls.Add(resultsControl);
AddNavigationButtons(panel, div);
}
}
示例15: AddActions
private void AddActions(HtmlGenericControl container)
{
using (HtmlGenericControl actions = new HtmlGenericControl("div"))
{
actions.Attributes.Add("class", "actions");
using (HtmlGenericControl buttons = new HtmlGenericControl("div"))
{
buttons.Attributes.Add("class", "ui buttons");
using (HtmlInputButton cancelButton = new HtmlInputButton())
{
cancelButton.Attributes.Add("class", "ui red button");
cancelButton.Value = Titles.Cancel;
buttons.Controls.Add(cancelButton);
}
using (HtmlInputButton verifyButton = new HtmlInputButton())
{
verifyButton.ID = "VerifyButton";
verifyButton.Attributes.Add("class", "ui green button");
verifyButton.Value = Titles.Verify;
verifyButton.Attributes.Add("title", "CTRL + RETURN");
buttons.Controls.Add(verifyButton);
}
actions.Controls.Add(buttons);
}
container.Controls.Add(actions);
}
}