本文整理汇总了C#中HtmlGenericControl类的典型用法代码示例。如果您正苦于以下问题:C# HtmlGenericControl类的具体用法?C# HtmlGenericControl怎么用?C# HtmlGenericControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlGenericControl类属于命名空间,在下文中一共展示了HtmlGenericControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getslides
public void getslides()
{
IDataReader reader = ((IDataReader)((IEnumerable)SqlDataSource4.Select(DataSourceSelectArguments.Empty)));
while (reader.Read())
{
var li = new HtmlGenericControl("li");
var a1 = new HtmlGenericControl("a");
//var a2 = new HtmlGenericControl("a");
a1.Attributes.Add("href", reader["slide_img"].ToString());
a1.Attributes.Add("title", "title");
///////////////////////////////////////////////////////////////////////
//a2.Attributes.Add("href", reader["path"].ToString());
//a2.Attributes.Add("target", "_blank");
var div = new HtmlGenericControl("div");
div.Attributes.Add("dir", Resources.admin.dir);
var h1 = new HtmlGenericControl("h1");
h1.InnerText = reader[Resources.admin.slidename].ToString();
var p = new HtmlGenericControl("p");
p.InnerText = reader[Resources.admin.slidedesc].ToString();
div.Controls.Add(h1);
div.Controls.Add(p);
div.Attributes.Add("style", "left:5px; top:94px; width:336px; height:0;");
li.Controls.Add(a1);
//li.Controls.Add(a2);
li.Controls.Add(div);
myslider.Controls.Add(li);
}
}
示例2: BuildMenuList
protected void BuildMenuList()
{
string cssClass = "";
string tmpl = "<a href=\"{0}.aspx\" class=\"{1}\"><span>{2}</span></a>";
HtmlGenericControl inbx = new HtmlGenericControl("li");
cssClass = Request.Path.ToLower().Contains("default.aspx") ? "current" : "";
inbx.InnerHtml = string.Format(tmpl, "Default", cssClass, "学员");
if (Request.Path.ToLower().Contains("default.aspx"))
{
hdr.InnerHtml = string.Format("{0}: {1}", "VIP管理", "学员");
}
UlMenu.Controls.Add(inbx);
HtmlGenericControl tech = new HtmlGenericControl("li");
cssClass = Request.Path.ToLower().Contains("teachers.aspx") ? "current" : "";
tech.InnerHtml = string.Format(tmpl, "Teachers", cssClass, "教师");
if (Request.Path.ToLower().Contains("teachers.aspx"))
{
hdr.InnerHtml = string.Format("{0}: {1}", "VIP管理", "教师");
}
UlMenu.Controls.Add(tech);
HtmlGenericControl orgn = new HtmlGenericControl("li");
cssClass = Request.Path.ToLower().Contains("organs.aspx") ? "current" : "";
orgn.InnerHtml = string.Format(tmpl, "Organs", cssClass, "机构");
if (Request.Path.ToLower().Contains("organs.aspx"))
{
hdr.InnerHtml = string.Format("{0}: {1}", "VIP管理", "机构");
}
UlMenu.Controls.Add(orgn);
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
int campID = Request["CampaignID"].ToInt();
string rptType = Request["RptType"];
if (campID == 0
|| string.IsNullOrEmpty(rptType)) return;
ReportType type = (ReportType)rptType.ToInt();
List<Donation> p = DonationBLL.Get(campID, type);
foreach (Donation item in p)
{
ThanksLetterUserControl uc = new ThanksLetterUserControl();
uc = (ThanksLetterUserControl)LoadControl("~/Collect/ThanksLetterUserControl.ascx");
uc.Fill_Letter(item);
divCon.Controls.Add(uc);
HtmlGenericControl gen = new HtmlGenericControl();
gen.TagName = "div";
gen.Attributes.Add("style", "page-break-after:always;");
divCon.Controls.Add(gen);
}
}
示例4: GetNews
public void GetNews()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["m-alkayan"].ConnectionString);
SqlCommand cmd = new SqlCommand("Select D_id,D_ename,D_aname,D_cat From Details Where D_cat=4", con);
con.Open();
SqlDataReader rd = cmd.ExecuteReader();
while (rd.Read())
{
var li = new HtmlGenericControl("li");
//var span = new HtmlGenericControl("span");
//var a = new HtmlGenericControl("a");
//var strong = new HtmlGenericControl("strong");
//a.InnerHtml = "<strong>" + Convert.ToDateTime(rd["D_date"]).Day.ToString("00") + "</strong>" + Convert.ToDateTime(rd["D_date"]).ToString("MMM");
//span.Controls.Add(a);
///////////////////////////////////////////
var p = new HtmlGenericControl("p");
var na = new HtmlGenericControl("a");
na.Attributes.Add("href", "../Details.aspx?id=" + rd["D_id"] + "&cat=" + rd["D_cat"]);
na.Attributes.Add("target","_top");
na.Attributes.Add("target", "_parent");
na.InnerText = rd[Resources.Default.name].ToString();
p.Controls.Add(na);
//li.Controls.Add(span);
li.Controls.Add(p);
news.Controls.Add(li);
}
con.Close();
}
示例5: create_menu
public void create_menu()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["m-alkayan"].ConnectionString);
SqlCommand cmd = new SqlCommand("Select * From Details Where D_cat=8 ORDER BY CONVERT(varchar(10), arr)", con);
con.Open();
SqlDataReader rd = cmd.ExecuteReader();
while (rd.Read())
{
var span = new HtmlGenericControl("span");
span.Attributes.Add("class","jFlowControl");
span.InnerText = "No 2";
controller.Controls.Add(span);
var a = new HtmlGenericControl("a");
a.Attributes.Add("href", "../Details.aspx?id=" + rd["D_id"].ToString() + "&cat=" + rd["D_cat"].ToString());
a.Attributes.Add("target", "_top");
a.Attributes.Add("target", "_parent");
///////////////////////////////////////////////////////
var img = new HtmlGenericControl("img");
img.Attributes.Add("src",rd["D_image"].ToString());
img.Attributes.Add("alt", rd["D_id"].ToString());
img.Attributes.Add("width", "298px");
img.Attributes.Add("height", "148px");
a.Controls.Add(img);
var p = new HtmlGenericControl("p");
p.InnerText = rd[Resources.Default.name].ToString();
var div = new HtmlGenericControl("div");
div.Controls.Add(a);
div.Controls.Add(p);
div.Attributes.Add("class", "proimage");
slides.Controls.Add(div);
}
con.Close();
}
示例6: LoadMarkupCategories
private void LoadMarkupCategories(Configuration.ApplicationRow application, AppState appState, OleDbConnection connection)
{
bool selected = false;
foreach (Configuration.ApplicationMarkupCategoryRow link in application.GetApplicationMarkupCategoryRows())
{
string roles = link.MarkupCategoryRow.IsAuthorizedRolesNull() ? "public" : link.MarkupCategoryRow.AuthorizedRoles;
if (AppUser.RoleIsInList(roles, connection))
{
HtmlGenericControl option = new HtmlGenericControl("option");
option.Attributes["value"] = link.CategoryID;
option.InnerText = link.MarkupCategoryRow.DisplayName;
if (link.CategoryID == appState.MarkupCategory)
{
option.Attributes["selected"] = "selected";
selected = true;
}
ddlMarkupCategory.Controls.Add(option);
}
}
if (!selected)
{
appState.MarkupCategory = "";
appState.MarkupGroups = new StringCollection();
if (ddlMarkupCategory.Controls.Count > 0)
{
appState.MarkupCategory = ((HtmlGenericControl)ddlMarkupCategory.Controls[0]).Attributes["value"];
}
}
}
示例7: generateDashs
protected void generateDashs(int[] timeSample, double[] valueSample)
{
try
{
for (int i = valueSample.Length-1; i >=0; i = i - 1)
{
if (timeSample[i - 1] > 0)
{
Utilities ut1 = Utilitie_S.EpochToDateTime(timeSample[i - 1]);
Utilities ut2 = Utilitie_S.EpochToDateTime(timeSample[i]);
HtmlGenericControl billDiv = new HtmlGenericControl("div");
billDiv.ID = "billDiv" + i;
billDiv.Attributes.Add("class", "bill-wrapper");
HtmlGenericControl hday = new HtmlGenericControl("h3");
hday.ID = "hday" + i;
hday.InnerText = ut1.Date.ToString("dd MMM");
HtmlGenericControl pUnits = new HtmlGenericControl("h2");
pUnits.ID = "pUnits" + i;
pUnits.InnerText = Math.Round((valueSample[i] - valueSample[i - 1])/1000,2).ToString();
billDiv.Controls.Add(hday);
billDiv.Controls.Add(pUnits);
dashes.Controls.Add(billDiv);
}
}
}
catch (Exception e)
{
}
}
示例8: BindMenu
private void BindMenu()
{
SiteMapNode root = SiteMap.Providers["SecuritySiteMap"].RootNode;
if (root != null)
{
foreach (SiteMapNode adminNode in root.ChildNodes)
{
if (adminNode.IsAccessibleToUser(HttpContext.Current))
{
if (!Request.RawUrl.ToUpperInvariant().Contains("/ADMIN/") && (adminNode.Url.Contains("xmanager") || adminNode.Url.Contains("PingServices")))
continue;
HtmlAnchor a = new HtmlAnchor();
a.HRef = adminNode.Url;
a.InnerHtml = "<span>" + Translate(adminNode.Title) + "</span>";//"<span>" + Translate(info.Name.Replace(".aspx", string.Empty)) + "</span>";
if (Request.RawUrl.EndsWith(adminNode.Url, StringComparison.OrdinalIgnoreCase))
a.Attributes["class"] = "current";
HtmlGenericControl li = new HtmlGenericControl("li");
li.Controls.Add(a);
ulMenu.Controls.Add(li);
}
}
}
if (!Request.RawUrl.ToUpperInvariant().Contains("/ADMIN/"))
AddItem(Resources.labels.changePassword, Utils.RelativeWebRoot + "login.aspx");
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// Core JQUERY JS Call
HtmlGenericControl jsquery = new HtmlGenericControl("script");
jsquery.Attributes.Add("type", "text/javascript");
jsquery.Attributes.Add("src", "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js");
Page.Header.Controls.Add(jsquery);
// Twitter Bootstrap
HtmlGenericControl tstrap = new HtmlGenericControl("script");
tstrap.Attributes.Add("type", "text/javascript");
tstrap.Attributes.Add("src", Config.GetUrl("twitter/bootstrap.min.js"));
Page.Header.Controls.Add(tstrap);
// VSK OWN JS Call
HtmlGenericControl vskjs = new HtmlGenericControl("script");
vskjs.Attributes.Add("type", "text/javascript");
vskjs.Attributes.Add("src", Config.GetUrl() + "javascript/vsk.js");
Page.Header.Controls.Add(vskjs);
// Activate for enabling round corners in IE Browser
// Note: You must remove round corner behavriour from buttons, textbox and other controls. it will disturb these controls
// while applying round corners.
HtmlGenericControl js_ie_round_corner = new HtmlGenericControl("script");
js_ie_round_corner.Attributes.Add("type", "text/javascript");
js_ie_round_corner.Attributes.Add("src", Config.GetUrl("javascript/DD_roundies.uicornerfix.js"));
Page.Header.Controls.Add(js_ie_round_corner);
}
示例10: btnAddShop_Click
protected void btnAddShop_Click(object sender, EventArgs e)
{
Button b = sender as Button;
if (b == null)
return;
//string cstr1 = "<dl><dt>网店名称:</dt><dd><input id=\"txt_addShopName\" runat=\"server\" type=\"text\" /></dd></dl>";
//string cstr2 = "<dl><dt>网店地址:</dt><dd><input id=\"txt_addShopUrl\" runat=\"server\" type=\"text\" /></dd></dl>";
Control cShopName = new HtmlGenericControl("dl");
HtmlGenericControl html = new HtmlGenericControl("dt");
html.InnerText = "网店名称";
cShopName.Controls.Add(html);
html = new HtmlGenericControl("dd");
cShopName.Controls.Add(html);
HtmlInputText input = new HtmlInputText("text");
input.ID = "txt_ShopName" + hid_ShopCount.Value;
cShopName.Controls[1].Controls.Add(input);
Control cShopUrl = new HtmlGenericControl("dl");
html = new HtmlGenericControl("dt");
html.InnerText = "网店地址";
cShopUrl.Controls.Add(html);
html = new HtmlGenericControl("dd");
cShopUrl.Controls.Add(html);
input = new HtmlInputText("text");
input.ID = "txt_ShopUrl" + hid_ShopCount.Value;
cShopUrl.Controls[1].Controls.Add(input);
b.Parent.Controls.AddAt(8, cShopUrl);
b.Parent.Controls.AddAt(8, cShopName);
int count = 1;
int.TryParse(hid_ShopCount.Value, out count);
hid_ShopCount.Value = (count++).ToString();
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
this.Title = Resources.labels.guestbook;
string query = Request.QueryString["theme"];
string theme = !string.IsNullOrEmpty(query) ? query : BlogSettings.Instance.Theme;
string path = string.Concat(Utils.RelativeWebRoot, "themes/", theme, "/", "PostViewForListLast.ascx");
var l = Post.Posts;
foreach (var p in l)
{
PostViewBase postView = (PostViewBase)LoadControl(path);
postView.Post = p;
postView.ShowExcerpt = true;
postView.Location = ServingLocation.PostList;
postView.ID = p.Id.ToString().Replace("-", string.Empty);
if(p != l.First())
{
var hgc = new HtmlGenericControl("div");
hgc.Attributes.Add("class", "shadow-post");
crNieuws.Controls.Add(hgc);
}
crNieuws.Controls.Add(postView);
}
}
示例12: getFollowers
protected void getFollowers()
{
uid = db.query(String.Format("SELECT user_id FROM profile WHERE url='{0}'"
, Request["user"].ToString())).Rows[0]["user_id"].ToString();
if (uid != null)
{
flw_det = db.query(String.Format("SELECT `profile`.url,follow.user_id,profile_photo.file_name " +
"FROM profile LEFT JOIN follow ON(profile.user_id = follow.follow_id) " +
" LEFT JOIN profile_photo ON(`profile`.user_id = profile_photo.user_id) " +
"WHERE follow.user_id = '{0}'", uid));
}
if (flw_det.Rows.Count != 0)
{
int n = flw_det.Rows.Count;
HtmlGenericControl[] search_a = new HtmlGenericControl[n];
HtmlGenericControl[] search_img = new HtmlGenericControl[n];
for (int i = 0; i < n; i++)
{
search_a[i] = new HtmlGenericControl("a") { ID = "image_link" };
search_img[i] = new HtmlGenericControl("img");
search_a[i].Attributes.Add("href", "profile.aspx?user=" + flw_det.Rows[i]["url"]);
search_img[i].Attributes.Add("class", "searched_img");
search_img[i].Attributes.Add("src", String.Format("upimage/{0}", flw_det.Rows[i]["file_name"]));
search_a[i].Controls.Add(search_img[i]);
follow_list.Controls.Add(search_a[i]);
}
}
}
示例13: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string sqlstring;
sqlstring = "SELECT Opis FROM [Przypomnienia] WHERE DataNastWywol <= GETDATE();";
using (var conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["HelpDesk1ConnectionString"].ConnectionString))
using (var cmd = conn.CreateCommand())
{
conn.Open();
cmd.CommandText = sqlstring;
var reader = cmd.ExecuteReader();
using (reader)
{
while (reader.HasRows)
{
while (reader.Read())
{
HtmlGenericControl li = new HtmlGenericControl("li");
li.InnerText = (string)reader.GetValue(0);
ListBox1.Controls.Add(li);
}
reader.NextResult();
}
}
}
}
示例14: constructControl
private HtmlGenericControl constructControl(IProvider provider)
{
string iconPath = Utility.GetSocialAuthConfiguration().IconFolder.Path ;
if (string.IsNullOrEmpty(iconPath))
iconPath = "images/socialauthicons/";
iconPath += provider.ProviderType.ToString() + ".png";
bool isconnected = SocialAuthUser.IsConnectedWith(provider.ProviderType);
bool iscurrent = (SocialAuthUser.CurrentProvider == provider.ProviderType);
HtmlGenericControl providerDiv = new HtmlGenericControl("div");
providerDiv.Attributes.Add("class", "provider");
ImageButton imgB = new ImageButton()
{
ID = "img" + provider.ProviderType,
CommandArgument = provider.ProviderType.ToString(),
ImageUrl = iconPath
};
if (isconnected)
{
HtmlGenericControl tickspan = new HtmlGenericControl("span");
tickspan.InnerHtml = "<img src='images/socialauthicons/" + (iscurrent ? "currentyes" : "yes") + ".png' style='top:0px;left:0px;z-index:100'/>";
tickspan.Style.Add("position", "absolute");
providerDiv.Controls.Add(tickspan);
}
//if (iscurrent)
// imgB.Style.Add("border", "1px solid yellow");
imgB.Command += new CommandEventHandler(imgB_Command);
providerDiv.Controls.Add(imgB);
return providerDiv;
}
示例15: BindMenu
private void BindMenu()
{
SiteMapNode root = SiteMap.Providers["SecuritySiteMap"].RootNode;
if (root != null)
{
foreach (SiteMapNode adminNode in root.ChildNodes)
{
if (adminNode.IsAccessibleToUser(HttpContext.Current))
{
if (!Request.RawUrl.ToUpperInvariant().Contains("/ADMIN/") && (adminNode.Url.Contains("xmanager") || adminNode.Url.Contains("PingServices")))
continue;
HtmlAnchor a = new HtmlAnchor();
a.HRef = adminNode.Url;
a.InnerHtml = "<span>" + Utils.Translate(adminNode.Title, adminNode.Title) + "</span>";//"<span>" + Utils.Translate(info.Name.Replace(".aspx", string.Empty)) + "</span>";
if (Request.RawUrl.IndexOf(adminNode.Url, StringComparison.OrdinalIgnoreCase) != -1)
a.Attributes["class"] = "current";
// if "page" has its own subfolder (comments, extensions) should
// select parent tab when navigating through child tabs
if (adminNode.Url.IndexOf("/admin/pages/", StringComparison.OrdinalIgnoreCase) == -1 && SubUrl(Request.RawUrl) == SubUrl(adminNode.Url))
a.Attributes["class"] = "current";
HtmlGenericControl li = new HtmlGenericControl("li");
li.Controls.Add(a);
ulMenu.Controls.Add(li);
}
}
}
if (!Request.RawUrl.ToUpperInvariant().Contains("/ADMIN/"))
AddItem(Resources.labels.changePassword, Utils.RelativeWebRoot + "login.aspx");
}