本文整理汇总了C#中HyperLink类的典型用法代码示例。如果您正苦于以下问题:C# HyperLink类的具体用法?C# HyperLink怎么用?C# HyperLink使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HyperLink类属于命名空间,在下文中一共展示了HyperLink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildNavigationAdmin
// Modify for Admin
// render navigation on admin side
public void BuildNavigationAdmin(int categoryID)
{
pnlNavi.Controls.Clear();
var hlM = new HyperLink
{
NavigateUrl = UrlService.GetAdminAbsoluteLink("catalog.aspx?CategoryID=0"),
CssClass = "Link",
Text = Resource.Client_MasterPage_Catalog
};
pnlNavi.Controls.Add(hlM);
var categoryList = CategoryService.GetParentCategories(categoryID);
for (var i = categoryList.Count - 1; i >= 0; i--)
{
var lblSeparator = new Label { CssClass = "Link", Text = @" > " };
pnlNavi.Controls.Add(lblSeparator);
var hl = new HyperLink
{
NavigateUrl = UrlService.GetAdminAbsoluteLink("catalog.aspx?CategoryID=" + categoryList[i].CategoryId),
CssClass = "Link",
Text = SQLDataHelper.GetString(categoryList[i].Name)
};
pnlNavi.Controls.Add(hl);
}
}
示例2: projectRepeater_ItemDataBound
// Project repeater data bound
void projectRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
BusinessLogic.Project project = (BusinessLogic.Project)e.Item.DataItem;
HtmlGenericControl imageContainer = (HtmlGenericControl)e.Item.FindControl("imgContainer");
// Get project thumbnail
HyperLink projectLink = new HyperLink();
projectLink.NavigateUrl = "/give/projects/" + project.SeoURL;
Image projectImage = new Image();
projectImage.CssClass = "shadow";
var thumbnail = project.RelatedMedias.FirstOrDefault(x => x.MediaType.Type == "Thumbnail");
if (thumbnail != null)
{
projectImage.ImageUrl = ResolveUrl(thumbnail.URL);
projectImage.AlternateText = thumbnail.DescriptionOrAltText;
}
else // Thumbnail not provided
{
projectImage.ImageUrl = ResolveUrl("~/Images/Project/NoImageProvided.jpg");
}
// Add image to container
projectLink.Controls.Add(projectImage);
imageContainer.Controls.Add(projectLink);
}
示例3: AddSiteCellInnerHTML
private HtmlTableCell AddSiteCellInnerHTML(string name, string banner, string url)
{
HtmlTableCell cell = new HtmlTableCell();
Panel pnl = new Panel();
pnl.CssClass = "sitesbanerhome";
if(IsSitePage)
{
pnl.CssClass = "sitespagebaner";
}
HyperLink hl = new HyperLink();
hl.NavigateUrl = url;
hl.Attributes["rel"] = "nofollow";
hl.Target = "_blank";
if (banner != "")
{
Image i = new Image();
i.ImageUrl = Path.Combine(Utils.GaleryImagePath, banner);
hl.Controls.Add(i);
}
else
{
hl.Text = name;
}
pnl.Controls.Add(hl);
cell.Controls.Add(pnl);
return cell;
}
示例4: Create
public static HyperLink Create(string Path, string Text, string Content)
{
var link = new HyperLink(ROOT, Path);
link.Text = Text;
link.Content = Content;
return link;
}
示例5: cargar_botones_internos
private void cargar_botones_internos()
{
TableRow filaTabla;
TableCell celdaTabla;
HyperLink link;
Image imagen;
int contadorFilas = 0;
filaTabla = new TableRow();
filaTabla.ID = "row_" + contadorFilas.ToString();
celdaTabla = new TableCell();
celdaTabla.ID = "cell_1_row_" + contadorFilas.ToString();
link = new HyperLink();
link.ID = "link_salir";
link.NavigateUrl = "javascript:window.close();";
link.CssClass = "botones_menu_principal";
imagen = new Image();
imagen.ImageUrl = "~/imagenes/areas/bMenuSalirEstandar.png";
imagen.Attributes.Add("onmouseover", "this.src='../imagenes/areas/bMenuSalirAccion.png'");
imagen.Attributes.Add("onmouseout", "this.src='../imagenes/areas/bMenuSalirEstandar.png'");
imagen.CssClass = "botones_menu_principal";
link.Controls.Add(imagen);
celdaTabla.Controls.Add(link);
filaTabla.Cells.Add(celdaTabla);
Table_MENU.Rows.Add(filaTabla);
}
示例6: setTable
protected void setTable()
{
DataTable myDataTable = new DataTable();
JobsModule myJobsModule = new JobsModule();
myJobsModule.setUserId((String)Session["userId"]);
myDataTable = myJobsModule.getEmployersJobPositions().Copy();
myDataTable.Columns.Add("Delete", typeof(String)).SetOrdinal(0);
myDataTable.Columns.Add("List of Applied Applicants", typeof(String)).SetOrdinal(4);
JobPositionsGridView.DataSource = myDataTable;
JobPositionsGridView.DataBind();
foreach (GridViewRow row in JobPositionsGridView.Rows)
{
LinkButton lb = new LinkButton();
lb.Text = "Delete";
lb.Click += new EventHandler(LinkButtonClicked);
row.Cells[0].Controls.Add(lb);
HyperLink hp = new HyperLink();
hp.Text = row.Cells[2].Text;
hp.NavigateUrl = "~/ShowJobPositionsManager.aspx?pId=" + row.Cells[1].Text;
row.Cells[2].Controls.Add(hp);
HyperLink hp2 = new HyperLink();
hp2.Text = "Show Applied Applicants";
hp2.NavigateUrl = "~/ListOfAppliedApplicants.aspx?pId=" + row.Cells[1].Text;
row.Cells[4].Controls.Add(hp2);
}
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (projects_directory == null)
{
projects_directory = new Panel();
// Generate Projects Row (bottom projects directory) based on contents of Projects folder
string[] files = { "ConcurrentContainers", "WiiMotion", "GameBoyEmulator", "SerializeQueue", "BubbleGrow", "GreyWeaver", "PreviewLite" };
foreach (string file_name in files)
{
Panel panel = new Panel();
panel.CssClass = "col-sm-3 col-xs-6";
HyperLink link = new HyperLink();
link.NavigateUrl = "~/Projects/" + file_name + ".aspx";
Image image = new Image();
image.CssClass = "img-responsive portfolio-item";
image.ImageUrl = "~/data/" + file_name + ".png";
link.Controls.Add(image);
panel.Controls.Add(link);
projects_directory.Controls.Add(panel);
}
}
ProjectsRow.Controls.Add(projects_directory);
}
示例8: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string ContentID = Request.QueryString["ContentID"].ToString();
OA.OAService service=new OA.OAService();
DataSet ds = service.FileContent_Select("Subject,Content,Attachment_ID,Attachment_Name", "Content_ID=" + ContentID, "");
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
lblText.Text = ds.Tables[0].Rows[0]["Subject"].ToString();
tdContent.InnerHtml = ds.Tables[0].Rows[0]["Content"].ToString();
// 添加附件信息
string strDirName = ds.Tables[0].Rows[0]["Attachment_ID"].ToString();
string strFiles = ds.Tables[0].Rows[0]["Attachment_Name"].ToString();
string[] strfile = strFiles.Split('*');
for (int i = 0; i < strfile.Length; i++)
{
// ../../OA/News/092/ckmsg.txt
HyperLink hl = new HyperLink();
string strPath = "..\\..\\..\\Attachment\\Files\\" + strDirName + "\\" + strfile[i];
hl.NavigateUrl = strPath;
hl.Text = strfile[i];
hl.Style.Add("cursor", "hand");
hl.Style.Add("font-Size", "14px");
hl.Target = "black";
DivAnnex.Controls.Add(hl);
Label lbl = new Label();
lbl.Width = 20;
DivAnnex.Controls.Add(lbl);
}
}
}
示例9: submitComment
protected void submitComment(object sender, EventArgs e)
{
//Connection String
string connString = System.Configuration.ConfigurationManager.ConnectionStrings["database"].ConnectionString;
string query = "UPDATE studentAssignments set checked='yes',[email protected] WHERE [email protected] AND [email protected]";
//Get Connection
SqlConnection conn = new SqlConnection(connString);
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Parameters.AddWithValue("@comment", comments.Text);
cmd.Parameters.AddWithValue("@userid", Context.Request["userid"]);
cmd.Parameters.AddWithValue("@id", Context.Request["id"]);
cmd.Connection = conn;
cmd.CommandText = query;
cmd.ExecuteNonQuery();
conn.Close();
submittedGrade.Controls.Clear();
HyperLink hl1 = new HyperLink();
submittedGrade.Controls.Add(new LiteralControl("<br/> Comment Submitted Successfully<br/>"));
hl1.NavigateUrl = "~/ta/studentAssignments.aspx";
hl1.Text = "Go Back";
submittedGrade.Controls.Add(hl1);
}
示例10: OnPreRender
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
MonkData db = new MonkData();
foreach(PropertyInfo tablePInfo in db.GetType().GetProperties())
{
Type[] genericTypes = tablePInfo.PropertyType.GetGenericArguments();
if(genericTypes.Count() < 1)
continue;
if(!CanUserAccessTable(genericTypes[0].Name, false, ref db))
{
continue;
}
HyperLink hlTypeEdit = new HyperLink();
hlTypeEdit.NavigateUrl = "AddEdit.aspx?typename=" + genericTypes[0].Name;
hlTypeEdit.Text = "Add " + GetFieldNameFromString( tablePInfo.Name);
plcAddItemsList.Controls.Add(hlTypeEdit);
Literal litLineBreak = new Literal();
litLineBreak.Text = "<br />";
plcAddItemsList.Controls.Add(litLineBreak);
HyperLink hlTypeGridView = new HyperLink();
hlTypeGridView.NavigateUrl = "GridView.aspx?typename=" + genericTypes[0].Name;
hlTypeGridView.Text = GetFieldNameFromString( tablePInfo.Name);
plcViewItems.Controls.Add(hlTypeGridView);
Literal litLineBreakGridView = new Literal();
litLineBreakGridView.Text = "<br />";
plcViewItems.Controls.Add(litLineBreakGridView);
}
}
示例11: RowDataBound
public void RowDataBound(object sender, GridRowEventArgs e)
{
if (e.Row.RowType == GridRowType.DataRow)
{
if (lastGroupHeader != null)
{
Literal textContainer = lastGroupHeader.Cells[0].Controls[0].Controls[lastGroupHeader.Cells[0].Controls[0].Controls.Count - 1].Controls[0] as Literal;
textContainer.Text = ((GridDataControlFieldCell)e.Row.Cells[2]).Text;
textContainer.Text += " » ";
HyperLink link = new HyperLink();
link.CssClass = "header-link";
link.Attributes["onclick"] = "alert('In a real application the category form should open.')";
link.NavigateUrl = "aspnet_grouping_custom_headers.aspx?CategoryID=" + ((GridDataControlFieldCell)e.Row.Cells[1]).Text;
link.Text = "Edit Category";
textContainer.Parent.Controls.Add(link);
lastGroupHeader = null;
}
}
else if (e.Row.RowType == GridRowType.GroupHeader)
{
if (e.Row.GroupLevel == 0)
{
lastGroupHeader = e.Row;
}
}
}
示例12: AddUrls
protected void AddUrls(string strAppKey, string strName, string strIcon, int count)
{
HyperLink link = new HyperLink();
link.ID = "CentrifyApp" + count;
link.NavigateUrl = Session["NewPodURL"].ToString() + CentRunAppURL + strAppKey + "&Auth=" + Session["OTP"].ToString();
link.Text = strName;
//If image is unsecured global
if (strIcon.Contains("vfslow"))
{
link.ImageUrl = Session["NewPodURL"].ToString() + strIcon;
}
else//If image needs a cookie or header to access
{
link.ImageUrl = "Helpers/GetSecureImage.aspx?Icon=" + strIcon;
}
link.ImageHeight = 75;
link.ImageWidth = 75;
if (count % 7 == 0)
{
Apps.Controls.Add(new LiteralControl("<br />"));
}
else
{
Apps.Controls.Add(new LiteralControl(" "));
}
Apps.Controls.Add(link);
}
示例13: getLatestProducts
//gets the first 8 products in the products list and displays them on the latest products section
public void getLatestProducts()
{
List<Product> p = (List<Product>)Session["Products"];
try
{
for (int i = 0; i < 8; i++)
{
Product product = p[i];
Image img = new Image();
HyperLink link = new HyperLink();
HtmlGenericControl a = new HtmlGenericControl("a");
HtmlGenericControl newLi = new HtmlGenericControl("li");
string prodID = Convert.ToString(product.ProdID);
img.ImageUrl = product.ProdImage;
img.ID = prodID;
link.NavigateUrl = "Product.aspx?id=" + prodID;
link.Controls.Add(img);
newLi.Controls.Add(link);
latestProducts.Controls.Add(newLi);
}
}
catch (Exception)
{
}
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Page.Unload += PageUnload;
ronUtil2 get = new ronUtil2();
DropDownList1.DataSource = get.getStudentIds();
if(!IsPostBack)
DropDownList1.DataBind();
int[] ID = get.getAdvisorIDs();
for (int ii = 0; ii < ID.Length; ii++)
{
TableCell[] td = new TableCell[8];
HyperLink link = new HyperLink();
link.NavigateUrl = "~/Schedule.aspx?AdvisorID=" + ID[ii];
for (int i = 0; i < 8; i++) { td[i] = new TableCell(); }
link.Text = get.getName(ID[ii]);
link.ForeColor=System.Drawing.Color.Yellow;
// link.Font.Bold = true;
td[0].Controls.Add(link);
td[1].Text = get.getDepartment(ID[ii]);
td[2].Text = get.getMonday(ID[ii]);
td[3].Text = get.getTuesday(ID[ii]);
td[4].Text = get.getWednesday(ID[ii]);
td[5].Text = get.getThursday(ID[ii]);
td[6].Text = get.getFriday(ID[ii]);
TableRow tRow = new TableRow();
myTable.Rows.Add(tRow);
tRow.Cells.AddRange(td);
}
}
示例15: SetUserInGroupInfo
private void SetUserInGroupInfo(User user)
{
int[] groups = user.Groups;
for (int i = 0; i < groups.Length; i++)
{
Group group = AdminServer.TheInstance.SecurityManager.GetGroup(groups[i]);
TableRow row = new TableRow();
TableCell cell = new TableCell();
HyperLink linkRemoveGroup = new HyperLink();
linkRemoveGroup.NavigateUrl = "UserGroup.aspx?userId=" + _user.SecurityObject.Id + "&groupId=" + group.SecurityObject.Id;
linkRemoveGroup.Text = StringDef.Remove;
linkRemoveGroup.SkinID = "SmallButton";
cell.Controls.Add(linkRemoveGroup);
row.Cells.Add(cell);
cell = new TableCell();
cell.Text = (i + 1).ToString();
row.Cells.Add(cell);
cell = new TableCell();
cell.Text = group.SecurityObject.Id.ToString();
row.Cells.Add(cell);
cell = new TableCell();
HyperLink linkEditGroup = new HyperLink();
linkEditGroup.NavigateUrl = "EditGroup.aspx?groupId=" + group.SecurityObject.Id;
linkEditGroup.Text = group.SecurityObject.Name;
linkEditGroup.SkinID = "PlainText";
cell.Controls.Add(linkEditGroup);
row.Cells.Add(cell);
cell = new TableCell();
cell.Text = group.SecurityObject.Comment;
row.Cells.Add(cell);
TableUserInGroup.Rows.Add(row);
}
}