本文整理汇总了C#中System.Web.UI.WebControls.HyperLink类的典型用法代码示例。如果您正苦于以下问题:C# HyperLink类的具体用法?C# HyperLink怎么用?C# HyperLink使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HyperLink类属于System.Web.UI.WebControls命名空间,在下文中一共展示了HyperLink类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: initPage
protected void initPage()
{
RegistedUser MySelf = new RegistedUser();
MySelf = (RegistedUser)Session["User"];
MySelf.Userservice = new UserServiceClasses.RegisterUserService();
List<Message> PublishMessageList = MySelf.Userservice.GetUserUreadPublicMessages(MySelf.UserName);
Panel single = new Panel();
foreach (Message singleMessage in PublishMessageList)
{
HyperLink MessageFrom = new HyperLink();
MessageFrom.Text = singleMessage.userFrom.NickName;
MessageFrom.NavigateUrl = "~/WebPage/UserOwnZonePage/UserOwnZonePage/UserOwnZonePage.aspx?VisitedUserID=" + singleMessage.userFrom.UserName; ;
single.Controls.Add(MessageFrom);
Label MessageCon = new Label();
MessageCon.Text = singleMessage.content;
single.Controls.Add(MessageCon);
ImageButton deleteButton = new ImageButton();
deleteButton.ImageUrl = "~/newpng/Trash.png";
deleteButton.Height = new Unit(48);
deleteButton.ID = singleMessage.ID.ToString();
deleteButton.OnClientClick += "DeleteItem";
deleteButton.Click += new ImageClickEventHandler(deleteButton_Click);
single.Controls.Add(deleteButton);
}
this.ALLPublicMessage.Controls.Add(single);
}
示例2: AddAnchor
protected virtual HyperLink AddAnchor(Control container, PluginContext context)
{
string tooltip = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? ToolTip;
string title = Utility.GetResourceString(GlobalResourceClassName, Name + ".Title") ?? Title;
string alternative = Utility.GetResourceString(GlobalResourceClassName, Name + ".AlternativeText") ?? AlternativeText;
HyperLink a = new HyperLink();
a.ID = "h" + Name;
a.NavigateUrl = context.Rebase(context.Format(UrlFormat, true));
a.SkinID = "ToolBarLink_" + Name;
a.Target = Target;
a.Attributes["class"] = Name + " " + RequiredPermission.ToString() + (string.IsNullOrEmpty(IconUrl) ? "" : " iconed");
if (UrlFormat.Contains("{"))
{
a.Attributes["class"] += " templatedurl";
a.Attributes["data-url-template"] = context.Rebase(UrlFormat);
}
a.ToolTip = tooltip;
a.Text = title;
ApplyStyles(context, a);
container.Controls.Add(a);
return a;
}
示例3: AddTo
public override Control AddTo(Control container, PluginContext context)
{
var selector = context.Engine.Resolve<LanguageGatewaySelector>();
if (!selector.Enabled || selector.LanguagesPerSite /*avoid showing options that might not be relevant */)
return null;
ILanguageGateway gateway = selector.GetAllLanguages();
HtmlGenericControl div = new HtmlGenericControl("div");
div.Attributes["class"] = "languages";
container.Controls.Add(div);
base.AddTo(div, context);
foreach (ILanguage language in gateway.GetAvailableLanguages())
{
Url url = Engine.ManagementPaths.ResolveResourceUrl("{ManagementUrl}/Content/Globalization/Translate.aspx");
url = url.AppendQuery("language", language.LanguageCode);
url = url.AppendQuery(SelectionUtility.SelectedQueryKey + "={selected}");
HyperLink h = new HyperLink();
h.ID = language.LanguageCode.Replace('-', '_').Replace(' ', '_');
h.Target = Targets.Preview;
h.NavigateUrl = context.Rebase(context.Format(url, true));
h.CssClass = "templatedurl language";
h.ToolTip = language.LanguageTitle;
h.Text = string.Format("<img src='{0}' alt=''/>", Url.ToAbsolute(language.FlagUrl));
h.Attributes["data-url-template"] = context.Rebase(url);
div.Controls.Add(h);
}
return div;
}
示例4: LoadSizes
private void LoadSizes()
{
var imageConfig = Engine.Resolve<EditSection>().Images;
string baseImagePath, imageSize;
ImagesUtility.SplitImageAndSize(Selection.SelectedItem.Url, imageConfig.Sizes.GetSizeNames(), out baseImagePath, out imageSize);
foreach (var size in imageConfig.Sizes.AllElements.Where(s => s.Announced))
{
var hl = new HyperLink();
hl.ID = size.Name + "Size";
bool exists;
var path = ImagesUtility.GetExistingImagePath(Engine.Resolve<IFileSystem>(), baseImagePath, size.Name, out exists);
if (exists)
{
var file = (SelectedFile.Parent as File) ?? SelectedFile;
hl.NavigateUrl = "File.aspx?selected=" + file.GetChild(VirtualPathUtility.GetFileName(path)).Path;
hl.Text = Utility.GetResourceString("ImageSizes", size.Name + ".Text") ?? (string.IsNullOrEmpty(size.Description) ? size.Name : size.Description);
hl.Text += GetSizeText(size.Width, size.Height);
hl.CssClass = "command";
if (path == Selection.SelectedItem.Url)
omSizes.Controls.AddAt(0, hl);
else
omSizes.Controls.Add(hl);
}
}
omSizes.Visible = omSizes.Controls.Count > 1;
}
示例5: SetupLinks
private void SetupLinks()
{
Panel pnlContent = unavContent;
HyperLink linkToAdd;
Image navDiv;
Int32 controlsToAdd = 0;
if (Page.Request.Url.ToString().ToLower().Contains("index")) { controlsToAdd++; } //We don't want to show the Home link if we are on home
for (Int32 i = controlsToAdd; i < pageNames.Length; i++)
{
linkToAdd = new HyperLink();
linkToAdd.NavigateUrl = pageLinks[i];
linkToAdd.Text = linkText[i];
if (Page.Request.Url.ToString().ToLower().Contains(pageNames[i]))
{
linkToAdd.Attributes.Add("class", "unavon");
}
pnlContent.Controls.Add(linkToAdd);
if (i < (pageNames.Length - 1))
{
navDiv = new Image();
navDiv.ImageUrl = "../Images/nav_div.gif";
navDiv.AlternateText = string.Empty;
navDiv.Width = 1;
navDiv.Height = 17;
navDiv.BorderWidth = 0;
pnlContent.Controls.Add(navDiv);
}
}
}
示例6: BuildCategoryPanel
public static Panel BuildCategoryPanel(BlogEntry entry)
{
Panel categoriesPanel = new Panel();
categoriesPanel.CssClass = "blogPostLabel";
categoriesPanel.Style.Add(HtmlTextWriterStyle.TextAlign, "right");
if (entry.Categories.Count > 0)
{
String category = entry.Categories[0];
HyperLink hyperLink = new HyperLink();
hyperLink.NavigateUrl = "blog.aspx?label=" + category;
hyperLink.Text = category;
categoriesPanel.Controls.Add(hyperLink);
}
for (int i = 1; i < entry.Categories.Count; i++)
{
String category = entry.Categories[i];
Literal labelSeparator = new Literal();
labelSeparator.Text = ", ";
categoriesPanel.Controls.Add(labelSeparator);
HyperLink hyperLink = new HyperLink();
hyperLink.NavigateUrl = "blog.aspx?label=" + category;
hyperLink.Text = category;
categoriesPanel.Controls.Add(hyperLink);
}
return categoriesPanel;
}
示例7: AddTo
public override Control AddTo(Control container, PluginContext context)
{
if(!ActiveFor(container, context.State)) return null;
if (context.Selected == null) return null;
if (context.Selected.VersionOf.HasValue) return null;
IEngine engine = Context.Current;
//TODO: fixme, cause items to be deserialized always
//ContentItem latestVersion = engine.Resolve<IVersionManager>().GetVersionsOf(context.Selected, 0, 1)[0];
var draft = engine.Resolve<DraftRepository>().GetDraftInfo(context.Selected);
if (draft == null)
return null;
var latestVersion = engine.Resolve<DraftRepository>().FindDrafts(context.Selected).Select(v => v.Version).FirstOrDefault();
if (latestVersion == null)
return null;
Url versionPreviewUrl = engine.GetContentAdapter<NodeAdapter>(latestVersion).GetPreviewUrl(latestVersion);
versionPreviewUrl = versionPreviewUrl.SetQueryParameter("edit", context.HttpContext.Request["edit"]);
HyperLink hl = new HyperLink();
hl.NavigateUrl = versionPreviewUrl;
hl.Text = GetInnerHtml(context, latestVersion.State == ContentState.Waiting ? "{IconsUrl}/clock_play.png".ResolveUrlTokens() : IconUrl, ToolTip, Title);
hl.CssClass = "preview";
hl.ToolTip = Utility.GetResourceString(GlobalResourceClassName, Name + ".ToolTip") ?? context.Format(ToolTip, false);
container.Controls.Add(hl);
return hl;
}
示例8: CreateControlLink
public HyperLink CreateControlLink(DataControlFieldCell cell
, String IdPropertyName
, String controllerObjectName
, String onClickClientEvent
, String imageUrl
, String altText
, Int32 columnIndex
, String businessKeyProperty
)
{
GridViewRow row = (GridViewRow)cell.BindingContainer;
if (row == null)
return null;
String value = GetObjectValue(row.DataItem, IdPropertyName);
String businessKeyPropertyValue = GetObjectValue(row.DataItem, businessKeyProperty);
if (String.IsNullOrEmpty(cell.Text) || String.Compare(cell.Text, " ") == 0 ||
String.IsNullOrEmpty(value))
return null;
HyperLink link = new HyperLink();
link.Text = cell.Text;
link.NavigateUrl = GetNavigationUrl(value, businessKeyPropertyValue, controllerObjectName, onClickClientEvent, columnIndex);
if (!String.IsNullOrEmpty(imageUrl))
link.Controls.Add(CreateImage(imageUrl, altText));
_navigateURL = link.NavigateUrl;
_text = link.Text;
_image = imageUrl;
return link;
}
示例9: PopulateCarousel
private void PopulateCarousel()
{
List<BLCategory> categories = BLCategory.RetrieveListFromDB(connectionString);
foreach (BLCategory category in categories)
{
Image image = new Image
{
CssClass = "carousel-image",
ImageUrl = $"ImgHandler.ashx?categoryId={category.Id}"
};
HyperLink link = new HyperLink
{
NavigateUrl = $"/Result.aspx?categoryId={category.Id}"
};
link.Controls.Add(image);
Label captionLabel = new Label
{
Text = $"<h3 style = 'color: #FFFFFF' > {category.Name} </ h3 >"
};
Panel captionPanel = new Panel { CssClass = "carousel-caption" };
captionPanel.Controls.Add(captionLabel);
Panel itemPanel = new Panel { CssClass = "item" };
itemPanel.Controls.Add(link);
itemPanel.Controls.Add(captionPanel);
categoryCarousel.Controls.Add(itemPanel);
}
}
示例10: fillCurriculumsList
private void fillCurriculumsList()
{
CurriculumsTable.Rows.Clear();
foreach (TblCurriculums curriculum in TeacherHelper.CurrentUserCurriculums())
{
TableRow curriculumRow = new TableRow();
TableCell curriculumCell = new TableCell();
HyperLink curriculumHyperLink = new HyperLink();
curriculumHyperLink.Text = curriculum.Name;
curriculumHyperLink.NavigateUrl = ServerModel.Forms.BuildRedirectUrl<TeachersListController>(
new TeachersListController { CourseId = -1, CurriculumId = curriculum.ID, BackUrl = RawUrl });
curriculumCell.Controls.Add(curriculumHyperLink);
curriculumRow.Cells.Add(curriculumCell);
CurriculumsTable.Rows.Add(curriculumRow);
}
if (CurriculumsTable.Rows.Count == 0)
{
TableRow curriculumRow = new TableRow();
TableCell curriculumCell = new TableCell();
HyperLink curriculumLink = new HyperLink();
curriculumLink.Text = noCurriculums;
curriculumLink.NavigateUrl = ServerModel.Forms.BuildRedirectUrl<CurriculumEditController>
(new CurriculumEditController { BackUrl = RawUrl });
curriculumCell.Controls.Add(curriculumLink);
curriculumRow.Cells.Add(curriculumCell);
CurriculumsTable.Rows.Add(curriculumRow);
}
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if(Request.QueryString["filename"] == null)
{
DirectoryInfo di = new DirectoryInfo(Server.MapPath("~/downloads"));
int i = 0;
foreach(FileInfo fi in di.GetFiles())
{
HyperLink HL = new HyperLink();
HL.ID = "HyperLink" + i++;
HL.Text = fi.Name;
HL.NavigateUrl = Request.FilePath + "?filename="+fi.Name;
ContentPlaceHolder cph = (ContentPlaceHolder)this.Master.FindControl("BodyContentPlaceholder");
cph.Controls.Add(HL);
cph.Controls.Add(new LiteralControl("<br/>"));
}
}
else
{
string filename = Request.QueryString["filename"];
if(filename != null)
{
ResponseFile(Request, Response, filename, MapPath("~/Downloads/" + filename), 100);
}
}
}
示例12: fillCoursesList
private void fillCoursesList()
{
CoursesTable.Rows.Clear();
foreach (TblCourses course in TeacherHelper.CurrentUserCourses())
{
TableRow courseRow = new TableRow();
TableCell courseCell = new TableCell();
HyperLink courseHyperLink = new HyperLink();
courseHyperLink.Text = course.Name;
courseHyperLink.NavigateUrl = ServerModel.Forms.BuildRedirectUrl<TeachersListController>(
new TeachersListController { CourseId = course.ID, CurriculumId = -1, BackUrl = RawUrl });
courseCell.Controls.Add(courseHyperLink);
courseRow.Cells.Add(courseCell);
CoursesTable.Rows.Add(courseRow);
}
if (CoursesTable.Rows.Count == 0)
{
TableRow courseRow = new TableRow();
TableCell courseCell = new TableCell();
HyperLink courseLink = new HyperLink();
courseLink.Text = noCourses;
courseLink.NavigateUrl = ServerModel.Forms.BuildRedirectUrl<CourseEditController>
(new CourseEditController { BackUrl = RawUrl });
courseCell.Controls.Add(courseLink);
courseRow.Cells.Add(courseCell);
CoursesTable.Rows.Add(courseRow);
}
}
示例13: grdCurrentStud_RowDataBound
protected void grdCurrentStud_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[0].Visible = false;
if (e.Row.RowType == DataControlRowType.DataRow)
{
//id="btnEdit" data-toggle="modal" data-target="#EditModal" runat="server" cssclass="btn icon-edit" xmlns:asp="#unknown"
string nStudentID = e.Row.Cells[0].Text;
HyperLink lb = new HyperLink();
lb.NavigateUrl = "#EditModal";
lb.ID = "lbStudents";
lb.Text = "View Details";
//lb.Attributes.Add("ID", "lnkStudent");
lb.Attributes.Add("data-id", nStudentID);
lb.Attributes.Add("title", "Select");
lb.Attributes.Add("class", "open-myModal btn-mini btn-primary");
lb.Attributes.Add("data-target", "#EditModal");
lb.Attributes.Add("data-toggle", "modal");
lb.Attributes.Add("onclick", "CallGetData('" + nStudentID + "');");
lb.Attributes.Add("runat", "server");
e.Row.Cells[7].Controls.Add(lb);
}
}
示例14: CreateCell
private TableCell CreateCell(string title, string url, bool selected, string imageUrlS, string imageUrlL)
{
TableCell cell = new TableCell();
Image img = new Image();
if(selected)
{
img.ImageUrl = imageUrlL;
img.Width = Unit.Pixel(40);
img.Height = Unit.Pixel(20);
Label lbl = new Label();
lbl.Text = title;
cell.Controls.Add(img);
cell.Controls.Add(lbl);
}
else
{
img.ImageUrl = imageUrlS;
img.Width = Unit.Pixel(20);
img.Height = Unit.Pixel(10);
HyperLink link = new HyperLink();
link.Text = title;
link.NavigateUrl = url;
cell.Controls.Add(img);
cell.Controls.Add(link);
}
return cell;
}
示例15: AddMethod
private void AddMethod(Control parent, IRpcMethodDescriptor method)
{
JsonRpcObsoleteAttribute obsoleteAttribute = JsonRpcObsoleteAttribute.Get(method.AttributeProvider);
Control methodSpan = AddSpan(parent,
obsoleteAttribute == null ? "method" : "method obsolete-method", null);
HyperLink link = new HyperLink();
link.CssClass = "method-name";
link.Text = Server.HtmlEncode(method.Name);
methodSpan.Controls.Add(link);
AddSignature(methodSpan, method);
string summary = JsonRpcHelpAttribute.GetText(method.AttributeProvider);
if (summary.Length > 0)
{
AddSpan(parent, "method-summary-sep", " - ");
AddSpan(parent, "method-summary", summary);
}
if (obsoleteAttribute != null)
{
AddSpan(parent, "obsolete-message", " This method has been obsoleted. " + obsoleteAttribute.Message);
}
}