本文整理汇总了C#中System.Web.UI.Page.ResolveClientUrl方法的典型用法代码示例。如果您正苦于以下问题:C# Page.ResolveClientUrl方法的具体用法?C# Page.ResolveClientUrl怎么用?C# Page.ResolveClientUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.Page
的用法示例。
在下文中一共展示了Page.ResolveClientUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddJs
public static void AddJs(Page page, string jsPath)
{
HtmlGenericControl jsRef = new HtmlGenericControl();
jsRef.TagName = "script";
jsRef.Attributes.Add("type", "text/javascript");
jsRef.Attributes.Add("src", page.ResolveClientUrl(jsPath));
page.Header.Controls.Add(jsRef);
}
示例2: AddCss
public static void AddCss(Page page, string cssPath)
{
HtmlGenericControl myCss = new HtmlGenericControl();
myCss.TagName = "link";
myCss.Attributes.Add("type", "text/css");
myCss.Attributes.Add("rel", "stylesheet");
myCss.Attributes.Add("src", page.ResolveClientUrl(cssPath));
page.Header.Controls.Add(myCss);
}
示例3: ShowAndRedirect
/// <summary>
/// 显示提示信息并且跳转页面
/// </summary>
/// <param name="page">调用页面</param>
/// <param name="message">显示提示信息内容</param>
/// <param name="url">跳转的页面地址</param>
public static void ShowAndRedirect(Page page, string message, string url)
{
if (url.StartsWith("~/"))
{
url = page.ResolveClientUrl(url);
}
StringBuilder Builder = new StringBuilder();
Builder.Append("<script language='javascript' defer>");
Builder.AppendFormat("alert('{0}');", message);
Builder.AppendFormat("self.location.href='{0}'", url);
Builder.Append("</script>");
page.ClientScript.RegisterStartupScript(page.GetType(), "message", Builder.ToString());
}
示例4: PopMsn
/// <summary>
/// 弹出消息
/// </summary>
/// <param name="strMessage">消息体</param>
/// <param name="strRedirectUrl">跳转地址</param>
/// <param name="page">所属窗体页(默认当前页)</param>
/// 创 建 人:王宇(wang_yu5)
/// 创建日期:2011-12-5
/// 修 改 人:
/// 修改日期:
public static void PopMsn(String strMessage, String strRedirectUrl = "", Page page = null)
{
if (String.IsNullOrEmpty(strMessage))
{
strMessage = strDefaultMsg;
}
if (page == null)
{
page = ((Page)HttpContext.Current.Handler);
}
if (!String.IsNullOrEmpty(strRedirectUrl))
{
strRedirectUrl = "location.href='" + page.ResolveClientUrl(strRedirectUrl) + "';";
}
strMessage = "alert('" + strMessage + "');";
page.ClientScript.RegisterStartupScript(page.ClientScript.GetType(), DateTime.Now.Ticks.ToString(), strMessage, true);
}
示例5: ConfirmMsg
/// <summary>
/// 弹出确认消息
/// </summary>
/// <param name="bIfSuccess">操作成功标识,true跳转,false后退</param>
/// <param name="strMessage">消息体</param>
/// <param name="strSuccessUrl">成功后跳转页面地址</param>
/// <param name="page">所属窗体页(默认当前页)</param>
public static void ConfirmMsg(bool bIfSuccess, String strMessage, String strSuccessUrl, Page page = null)
{
if (String.IsNullOrEmpty(strMessage))
{
strMessage = strDefaultMsg;
}
if (page == null)
{
page = ((Page)HttpContext.Current.Handler);
}
if (bIfSuccess)
{
strMessage = "if(confirm('" + strMessage + "')){ location.href='" + page.ResolveClientUrl(strSuccessUrl) + "' ;} else{ window.location.reload(); }";
}
else
{
strMessage = "alert('" + strMessage + "');history.back();";
}
page.ClientScript.RegisterStartupScript(page.ClientScript.GetType(), DateTime.Now.Ticks.ToString(), strMessage, true);
}
示例6: GenerateFileLink
private static void GenerateFileLink(string url, Page page)
{
if(page == null || page.Header == null || string.IsNullOrWhiteSpace(url))
return;
var links = _pageLinks.GetOrAdd(page, new HashSet<string>(StringComparer.Ordinal));
lock(links)
{
//如果添加操作返回假则表示当前Url已经存在,则退出
if(!links.Add(url.ToLowerInvariant()))
return;
}
if(url.EndsWith(".css", StringComparison.OrdinalIgnoreCase))
{
var link = new System.Web.UI.HtmlControls.HtmlLink()
{
Href = url,
};
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "Stylesheet");
page.Header.Controls.Add(link);
}
else if(url.EndsWith(".js", StringComparison.OrdinalIgnoreCase))
{
var script = new System.Web.UI.HtmlControls.HtmlGenericControl("script");
script.Attributes.Add("type", "text/javascript");
script.Attributes.Add("src", page.ResolveClientUrl(url));
page.Header.Controls.Add(script);
}
}
示例7: Register
public static bool Register(Page page, string Source, bool composite)
{
if (page.Request.Browser.EcmaScriptVersion.Major >= 1) {
if (Source != null) {
var scriptManager = ScriptManager.GetCurrent(page);
if (scriptManager != null) {
#if DEBUG
composite = false;
#endif
if (!scriptManager.Scripts.Any(s => s.Path == "~/Silversite/JavaScript/Silversite.js.aspx")) scriptManager.Scripts.Add(new ScriptReference("~/Silversite/JavaScript/Silversite.js.aspx"));
#if Microsoft
if (!composite || Services.Runtime.IsMono) {
if (!scriptManager.Scripts.Any( s => s.Path == Source)) scriptManager.Scripts.Add(new ScriptReference(Source));
} else {
if (!scriptManager.CompositeScript.Scripts.Any(s => s.Path == Source)) scriptManager.CompositeScript.Scripts.Add(new ScriptReference(Source));
}
#else
scriptManager.Scripts.Add(new ScriptReference(Source));
#endif
} else {
if (!page.ClientScript.IsClientScriptIncludeRegistered("Silversite.js")) page.ClientScript.RegisterClientScriptInclude("Silversite.js", "~/Silversite/JavaScript/Silversite.js.aspx");
page.ClientScript.RegisterClientScriptInclude(Source.GetHashCode().ToString(), page.ResolveClientUrl(Source));
}
return true;
}
}
return false;
}
示例8: GetContactLink
public static string GetContactLink(Page pageInstance, PrimaryKeyId ContactUid, string ClientName)
{
bool canEdit = true;
if (Security.IsUserInGroup(InternalSecureGroups.Partner))
{
int groupId = User.GetGroupForPartnerUser(Security.CurrentUser.UserID);
using (IDataReader reader = SecureGroup.GetGroup(groupId))
{
if (reader.Read())
{
if (reader["OrgUid"] != DBNull.Value)
{
PrimaryKeyId partnerOrgUid = PrimaryKeyId.Parse(reader["OrgUid"].ToString());
ContactEntity contactEntity = (ContactEntity)BusinessManager.Load(ContactEntity.GetAssignedMetaClassName(), ContactUid);
if (!contactEntity.OrganizationId.HasValue || contactEntity.OrganizationId.Value != partnerOrgUid)
canEdit = false;
}
else if (reader["ContactUid"] == DBNull.Value || PrimaryKeyId.Parse(reader["ContactUid"].ToString()) != ContactUid)
canEdit = false;
}
}
}
if (canEdit && !Security.CurrentUser.IsExternal)
return String.Format(CultureInfo.InvariantCulture,
"<a href='{0}'>{1}</a>",
pageInstance.ResolveClientUrl(CHelper.GetLinkEntityView(ContactEntity.GetAssignedMetaClassName(), ContactUid.ToString())),
ClientName);
else
return ClientName;
}
示例9: GetClientLink
public static string GetClientLink(Page pageInstance, PrimaryKeyId OrgUid, PrimaryKeyId ContactUid, string ClientName)
{
bool canOrgEdit = true;
bool canClientEdit = true;
ContactEntity contactEntity = null;
if (ContactUid != PrimaryKeyId.Empty)
{
try
{
contactEntity = (ContactEntity)BusinessManager.Load(ContactEntity.GetAssignedMetaClassName(), ContactUid);
}
catch
{
return String.Empty;
}
}
if (Security.IsUserInGroup(InternalSecureGroups.Partner))
{
canOrgEdit = false;
canClientEdit = false;
int groupId = User.GetGroupForPartnerUser(Security.CurrentUser.UserID);
PrimaryKeyId partnerOrgUid = PrimaryKeyId.Empty;
PrimaryKeyId partnerContactUid = PrimaryKeyId.Empty;
using (IDataReader reader = SecureGroup.GetGroup(groupId))
{
if (reader.Read())
{
if (reader["OrgUid"] != DBNull.Value)
partnerOrgUid = PrimaryKeyId.Parse(reader["OrgUid"].ToString());
if (reader["ContactUid"] != DBNull.Value)
partnerContactUid = PrimaryKeyId.Parse(reader["ContactUid"].ToString());
}
}
if (OrgUid != PrimaryKeyId.Empty)
{
if (partnerOrgUid == OrgUid)
canOrgEdit = true;
}
else if (ContactUid != PrimaryKeyId.Empty)
{
if (partnerOrgUid != PrimaryKeyId.Empty
&& contactEntity.OrganizationId.HasValue
&& partnerOrgUid == contactEntity.OrganizationId.Value)
{
canOrgEdit = true;
canClientEdit = true;
}
if (partnerContactUid != PrimaryKeyId.Empty && partnerContactUid == ContactUid)
{
canOrgEdit = false;
canClientEdit = true;
}
}
}
string retval = "";
if (OrgUid != PrimaryKeyId.Empty)
{
if (canOrgEdit && !Security.CurrentUser.IsExternal)
retval = String.Format(CultureInfo.InvariantCulture,
"<a href='{0}'>{1}</a>",
pageInstance.ResolveClientUrl(CHelper.GetLinkEntityView(OrganizationEntity.GetAssignedMetaClassName(), OrgUid.ToString())),
ClientName);
else
retval = ClientName;
}
else if (ContactUid != PrimaryKeyId.Empty)
{
if (!String.IsNullOrEmpty(contactEntity.Organization))
{
if (!Security.CurrentUser.IsExternal)
{
if (canOrgEdit && canClientEdit)
retval = String.Format(CultureInfo.InvariantCulture,
"<a href='{0}'>{1}</a> ( <a href='{2}'>{3}</a> )",
pageInstance.ResolveClientUrl(CHelper.GetLinkEntityView(ContactEntity.GetAssignedMetaClassName(), ContactUid.ToString())),
ClientName,
pageInstance.ResolveClientUrl(CHelper.GetLinkEntityView(OrganizationEntity.GetAssignedMetaClassName(), contactEntity.OrganizationId.ToString())),
contactEntity.Organization);
else if (canOrgEdit && !canClientEdit)
retval = String.Format(CultureInfo.InvariantCulture,
"{0} ( <a href='{1}'>{2}</a> )",
ClientName,
pageInstance.ResolveClientUrl(CHelper.GetLinkEntityView(OrganizationEntity.GetAssignedMetaClassName(), contactEntity.OrganizationId.ToString())),
contactEntity.Organization);
else if (!canOrgEdit && canClientEdit)
retval = String.Format(CultureInfo.InvariantCulture,
"<a href='{0}'>{1}</a> ( {2} )",
pageInstance.ResolveClientUrl(CHelper.GetLinkEntityView(ContactEntity.GetAssignedMetaClassName(), ContactUid.ToString())),
ClientName,
contactEntity.Organization);
else
retval = String.Format(CultureInfo.InvariantCulture,
"{0} ( {1} )",
ClientName,
contactEntity.Organization);
}
//.........这里部分代码省略.........
示例10: GetMetaClassAdminPageLink
public static string GetMetaClassAdminPageLink(MetaClass mc, Page page)
{
string friendlyName = GetResFileString(mc.FriendlyName);
string retval = friendlyName;
if (ListManager.MetaClassIsList(mc)) // list
{
if (Mediachase.IBN.Business.ListInfoBus.CanAdmin(ListManager.GetListIdByClassName(mc.Name)))
{
retval = String.Format(CultureInfo.InvariantCulture,
"<a href='{0}?class={1}'>{2}</a>",
page.ResolveClientUrl(ListAdminPage),
mc.Name,
friendlyName);
}
}
else // not list
{
if (CheckMetaClassIsPublic(mc))
{
retval = String.Format(CultureInfo.InvariantCulture,
"<a href='{0}?class={1}'>{2}</a>",
page.ResolveClientUrl(MetaClassAdminPage),
mc.Name,
friendlyName);
}
}
return retval;
}
示例11: GetPriorityIcon
public static string GetPriorityIcon(int priorityId, Page page)
{
string icon;
string tooltip;
if (priorityId < 500)
{
icon = "PriorityLow.gif";
tooltip = HttpContext.GetGlobalResourceObject("IbnFramework.Common", "PriorityLow").ToString();
}
else if (priorityId < 750)
{
icon = "PriorityNormal.gif";
tooltip = HttpContext.GetGlobalResourceObject("IbnFramework.Common", "PriorityNormal").ToString();
}
else if (priorityId < 900)
{
icon = "PriorityHigh.gif";
tooltip = HttpContext.GetGlobalResourceObject("IbnFramework.Common", "PriorityHigh").ToString();
}
else if (priorityId < 1000)
{
icon = "PriorityVeryHigh.gif";
tooltip = HttpContext.GetGlobalResourceObject("IbnFramework.Common", "PriorityVeryHigh").ToString();
}
else
{
icon = "PriorityUrgent.gif";
tooltip = HttpContext.GetGlobalResourceObject("IbnFramework.Common", "PriorityUrgent").ToString();
}
return String.Format(CultureInfo.InvariantCulture,
"<img src='{0}' alt='{1}' title='{1}'/>",
page.ResolveClientUrl("~/Layouts/Images/icons/" + icon),
tooltip);
}
示例12: GetOrganizationLink
public static string GetOrganizationLink(Page pageInstance, PrimaryKeyId OrgUid, string OrgName)
{
bool canEdit = true;
if (Security.IsUserInGroup(InternalSecureGroups.Partner))
{
int groupId = User.GetGroupForPartnerUser(Security.CurrentUser.UserID);
using (IDataReader reader = SecureGroup.GetGroup(groupId))
{
if (reader.Read())
{
if (reader["OrgUid"] == DBNull.Value || PrimaryKeyId.Parse(reader["OrgUid"].ToString()) != OrgUid)
canEdit = false;
}
}
}
if (canEdit && !Security.CurrentUser.IsExternal)
return String.Format(CultureInfo.InvariantCulture,
"<a href='{0}'>{1}</a>",
pageInstance.ResolveClientUrl(CHelper.GetLinkEntityView(OrganizationEntity.GetAssignedMetaClassName(), OrgUid.ToString())),
OrgName);
else
return OrgName;
}
示例13: GetObjectLink
public static string GetObjectLink(int objectTypeId, int objectId, Page page)
{
string retVal = string.Empty;
switch (objectTypeId)
{
case (int)ObjectTypes.CalendarEntry:
retVal = String.Format(
CultureInfo.InvariantCulture,
"{0}?EventId={1}",
page.ResolveClientUrl("~/Events/EventView.aspx"),
objectId);
break;
case (int)ObjectTypes.Document:
retVal = String.Format(
CultureInfo.InvariantCulture,
"{0}?DocumentId={1}",
page.ResolveClientUrl("~/Documents/DocumentView.aspx"),
objectId);
break;
case (int)ObjectTypes.Issue:
retVal = String.Format(
CultureInfo.InvariantCulture,
"{0}?IncidentId={1}",
page.ResolveClientUrl("~/Incidents/IncidentView.aspx"),
objectId);
break;
case (int)ObjectTypes.IssueRequest:
retVal = String.Format(
CultureInfo.InvariantCulture,
"{0}?RequestId={1}",
page.ResolveClientUrl("~/Incidents/MailRequestView.aspx"),
objectId);
break;
case (int)ObjectTypes.KnowledgeBase:
retVal = String.Format(
CultureInfo.InvariantCulture,
"{0}?ArticleId={1}",
page.ResolveClientUrl("~/Incidents/ArticleView.aspx"),
objectId);
break;
case (int)ObjectTypes.List:
retVal = String.Format(
CultureInfo.InvariantCulture,
"{0}?ClassName=List_{1}",
page.ResolveClientUrl("~/Apps/MetaUIEntity/Pages/EntityList.aspx"),
objectId);
break;
case (int)ObjectTypes.Project:
retVal = String.Format(
CultureInfo.InvariantCulture,
"{0}?ProjectId={1}",
page.ResolveClientUrl("~/Projects/ProjectView.aspx"),
objectId);
break;
case (int)ObjectTypes.Task:
retVal = String.Format(
CultureInfo.InvariantCulture,
"{0}?TaskId={1}",
page.ResolveClientUrl("~/Tasks/TaskView.aspx"),
objectId);
break;
case (int)ObjectTypes.ToDo:
retVal = String.Format(
CultureInfo.InvariantCulture,
"{0}?ToDoId={1}",
page.ResolveClientUrl("~/ToDo/ToDoView.aspx"),
objectId);
break;
case (int)ObjectTypes.User:
retVal = String.Format(
CultureInfo.InvariantCulture,
"{0}?UserId={1}",
page.ResolveClientUrl("~/Directory/UserView.aspx"),
objectId);
break;
}
return retVal;
}
示例14: GetIncidentTitle
public static string GetIncidentTitle(Page pageInstance, string title, int incidentId, bool isOverdue, int stateId, string stateName, bool isBoldText)
{
string img = "incident_closed.gif";
if (isOverdue)
{
img = "incident_overdue.gif";
stateName = String.Format(CultureInfo.InvariantCulture,
"{0}, {1}",
stateName,
HttpContext.GetGlobalResourceObject("IbnFramework.Incident", "Overdue"));
}
else if (stateId == (int)ObjectStates.Upcoming)
{
img = "incident_new.gif";
}
else if (stateId == (int)ObjectStates.Active || stateId == (int)ObjectStates.ReOpen || stateId == (int)ObjectStates.OnCheck)
{
img = "incident_active.gif";
}
if (!Security.CurrentUser.IsExternal)
return String.Format(CultureInfo.InvariantCulture,
"<a href='{0}?IncidentId={1}'><img alt='{4}' src='{2}/{3}' title='{4}'/> {5}</a>",
pageInstance.ResolveClientUrl("~/Incidents/IncidentView.aspx"),
incidentId,
pageInstance.ResolveClientUrl("~/layouts/images/icons"),
img,
stateName,
((isBoldText) ? ("<b>" + title + "</b>") : title));
else return String.Format(CultureInfo.InvariantCulture,
"<img alt='{2}' src='{0}/{1}' title='{2}'/> {3}",
pageInstance.ResolveClientUrl("~/Layouts/Images/icons"),
img,
stateName,
((isBoldText) ? ("<b>" + title + "</b>") : title));
}
示例15: LoadExtJsGridScripts
/// <summary>
/// Loads the ext js grid scripts.
/// </summary>
/// <param name="p">The p.</param>
public static void LoadExtJsGridScripts(Page page)
{
if (page == null)
throw new ArgumentNullException("page");
if (ScriptManager.GetCurrent(page) == null)
throw new NullReferenceException("ScriptManager.GetCurrent(page) returned null.");
if (McScriptLoader.Current == null)
throw new NullReferenceException("McScriptLoader.Current returned null.");
ScriptManager.GetCurrent(page).Scripts.Add(new ScriptReference(McScriptLoader.Current.GetScriptReferenceUrl("~/Scripts/IbnFramework/ext-all.js")));
page.ClientScript.RegisterClientScriptBlock(page.GetType(), Guid.NewGuid().ToString(),
String.Format("<link type='text/css' rel='stylesheet' href='{0}' />", page.ResolveClientUrl("~/styles/IbnFramework/ext-all2.css")));
}