本文整理汇总了C#中System.Web.Mvc.ViewContext.UrlHelper方法的典型用法代码示例。如果您正苦于以下问题:C# ViewContext.UrlHelper方法的具体用法?C# ViewContext.UrlHelper怎么用?C# ViewContext.UrlHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Mvc.ViewContext
的用法示例。
在下文中一共展示了ViewContext.UrlHelper方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderItemColumn
public override IHtmlString RenderItemColumn(ViewContext viewContext)
{
WebEventModel webEventModel = (WebEventModel)this.DataItem;
string editLinkUrl = viewContext.UrlHelper()
.Action("Details", viewContext.RequestContext.AllRouteValues()
.Merge("fullname", webEventModel.FullName)
.Merge("returnUrl", viewContext.HttpContext.Request.RawUrl));
string editLinkText = webEventModel.FileName;
return new HtmlString(String.Format("<a href='{0}'><img class='icon' src='{2}'/> {1}</a>", editLinkUrl, editLinkText, UrlUtility.ResolveUrl("~/Images/invis.gif")));
}
示例2: RenderItemColumn
public override IHtmlString RenderItemColumn(ViewContext viewContext)
{
if (DataItem is IIdentifiable)
{
var data = (IIdentifiable)DataItem;
var linkText = "Report".Localize();
if (!string.IsNullOrEmpty(this.GridColumn.PropertyName))
{
linkText = this.PropertyValue == null ? "" : PropertyValue.ToString();
}
var url = viewContext.UrlHelper().Action("HitReport"
, viewContext.RequestContext.AllRouteValues().Merge("UUID", data.UUID).Merge("return", viewContext.HttpContext.Request.RawUrl));
return new HtmlString(string.Format("<a href='{0}'><img class='icon {2}' src='{3}'/> {1}</a>", url, linkText,
"", Kooboo.Web.Url.UrlUtility.ResolveUrl("~/Images/invis.gif")));
}
return new HtmlString("");
}
示例3: RenderItemColumn
public override IHtmlString RenderItemColumn(ViewContext viewContext)
{
if (PropertyValue == null)
{
return MvcHtmlString.Empty;
}
var columnAttr = GridColumn.ColumnAttribute as LinkColumnAttribute;
if (columnAttr == null)
{
return MvcHtmlString.Empty;
}
var idProperty = GridColumn.GridModel.IdPorperty ?? "Id";
var extraRouteValues = viewContext.RequestContext.AllRouteValues().Merge(idProperty, GetDataItemId(DataItem, idProperty));
extraRouteValues = extraRouteValues.Merge("return", viewContext.HttpContext.Request.RawUrl);
var url = viewContext.UrlHelper().Action(columnAttr.TargetAction, extraRouteValues);
return new HtmlString(string.Format("<a href='{0}'><img class='icon {2}' src='{3}'/> {1}</a>", url, PropertyValue.ToString(),
Class, Kooboo.Web.Url.UrlUtility.ResolveUrl("~/Images/invis.gif")));
}