我试过这样的东西,但我卡住了:
TypedValue typedValue = new TypedValue();
if (this.parentActivity.getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true))
{
// how to get color?
}
Run Code Online (Sandbox Code Playgroud) 为什么我使用下面的代码收到此错误 ParseException: End of string expected at position 4.
这是代码:错误在第3行.
var db = Sitecore.Configuration.Factory.GetDatabase("web");
string query = @"fast:/sitecore/content/foodservice/home/Products/3492-5326/3518-7";
Item item = db.SelectSingleItem(query);
return item;
Run Code Online (Sandbox Code Playgroud)
我们可以使用快速查询SelectSingleItem()吗?我试图避免这些get folder contents and loop through each item until I find the target solution.建议?
我正在设置一个页面,并且很难让它在浏览器中看起来很好(实际上只是IE,因为它适用于mozilla和webkit).在认真考虑自IE6以来修复的旧IE错误之前,我想排除怪异模式.容器页面具有声明的doctype,但iframe代码没有.iframe内容是以quirks-mode(因为它没有doctype)还是标准模式(因为容器有doctype)呈现的?来源遵循这个方案:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
...
<body>
...
<iframe ...>
<html>
<head>
...
</head>
<body>
....
</body>
</html>
</iframe>
...
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我有这个代码:
private AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
private PendingIntent alarmIntent = PendingIntent.getBroadcast(this, 0, new Intent("my action-name"), 0);
alarmManager.setInexactRepeating((int)AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + autoUpdateIntervalInMinutes * 60 * 1000, autoUpdateIntervalInMinutes * 60 * 1000, alarmIntent);
Run Code Online (Sandbox Code Playgroud)
但是我想为LocalBroadcastManager更改它.这可能吗?
我有以下内容
<label for="Forename">Forename</label>
<%= Html.TextBoxFor(m => m.Customer.Name.Forename) %>
Run Code Online (Sandbox Code Playgroud)
这个问题是这个呈现为
<label for="Forename">Forename</label>
<input type="text" value="" name="Customer.Name.Forename" id="Customer_Name_Forename">
Run Code Online (Sandbox Code Playgroud)
不是我想要的.
我想要一个扩展来正确呈现标签(即使用具有输入id值的for =""属性),在我编写自己的扩展之前,MVC 2中有什么东西可以做到这一点吗?
如何使用Sitecore控件在子布局中呈现媒体库项目图像?对于具有"图像"字段的普通内容项,它只是一块蛋糕......只需使用sc:Image或FieldRenderer控制.但我有这样的事情:
<asp:Repeater ID="rptImages" runat="server">
<ItemTemplate>
<sc:FieldRenderer ????>
</ItemTemplate>
</asp:Repater>
Run Code Online (Sandbox Code Playgroud)
而背后的代码:
rptImages.DataSource = Sitecore.Context.Database.SelectItems("/sitecore/Media Library/Images/Some Image Folder/*")
rptImages.DataBind();
Run Code Online (Sandbox Code Playgroud)
那么...... ItemTemplate会发生什么?我可以使用ItemDataBound事件来做一些手动分配,但是我不清楚如何去做.我觉得我在这里错过了一些非常简单的东西.
我有一个很大的数据库现有数据库,我首先使用EF 5.0数据库,我遇到的问题是,如果我[stringlength(50)]在类上创建任何数据装饰然后上传数据库,当我"上传从数据库"所有数据注释都消失了.如何保留它们?
data-annotations ef-database-first asp.net-mvc-4 entity-framework-5
我正在尝试在工作流程命令上实现一个基本的Javascript确认框(例如"你确定要编辑它吗?").根据用户是单击是还是否,我想转到工作流程中的其他状态.这是我目前的代码(取出一些逻辑):
[Serializable]
public class ConfirmAction
{
public void Process(WorkflowPipelineArgs args)
{
Item currentItem = args.DataItem;
ClientPipelineArgs clientArgs = new ClientPipelineArgs();
Sitecore.Context.ClientPage.Start(this, "DialogProcessor", clientArgs);
}
protected void DialogProcessor(ClientPipelineArgs args)
{
if (args.IsPostBack)
{
if (args.Result != "yes")
{
args.AbortPipeline();
return;
}
}
else
{
Sitecore.Context.ClientPage.ClientResponse.Confirm("Are you sure you want to edit this?");
args.WaitForPostBack();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我是Pipeline模型的新手,特别是与Sitecore有关,所以我有点掌握稻草.我相信,我遇到的问题是,我没有办法将结果从ClientResponse管道返回到工作流管道,告诉它该做什么.
谢谢.
编辑:
使用Yan的信息,我最终想出了以下解决方案:
public void Process(WorkflowPipelineArgs args)
{
Item currentItem = args.DataItem;
ClientPipelineArgs clientArgs = new ClientPipelineArgs();
clientArgs.Parameters.Add("itemID", currentItem.ID.ToString());
clientArgs.Parameters.Add("stateID", currentItem.Fields["__Workflow state"].Value);
Sitecore.Context.ClientPage.Start(this, "DialogProcessor", …Run Code Online (Sandbox Code Playgroud) 在Sitecore中,是否可以设置工作流程,以便更改项目的某个字段不会导致项目进入审批状态?
我们希望有几个字段可编辑并立即发布,同时强制执行工作流以更改到一个特定字段.如果编辑此字段会将项目传递到"等待批准"状态.
我在参考文献中没有找到任何关于如何做到这一点的内容.
我已经编写了一些代码,这些代码来自Steve的回复和这个代码片段的示例:
class Filter
{
public void Process(WorkflowPipelineArgs args)
{
Database master = Factory.GetDatabase("master");
Item item = args.DataItem;
IWorkflow wf = master.WorkflowProvider.GetWorkflow(item);
AllowPublishIfNoChangeToBodyField(item, wf);
}
/// <summary>
/// If the item's 'Body' field was not modified change the workflow state to Pending Publication
/// by running the Approve and Submit for Publication command
/// </summary>
/// <param name="item"></param>
/// <param name="wf"></param>
void AllowPublishIfNoChangeToBodyField(Item item, IWorkflow wf)
{
using (new Sitecore.SecurityModel.SecurityDisabler())
{
if (true//pseudo code …Run Code Online (Sandbox Code Playgroud) 我正在使用一个非常通用的XML结构,其中所有内容都是一个项目(无论如何,所有与此问题相关的内容).
基于知道我当前正在使用的item元素以及作为我正在寻找的节点的父元素的item元素,我需要找到一个项目.我有一个工作的xpath,但它是相当资源密集型的,我正在寻找更优雅,更便宜的东西.
item key =一个节点是我正在寻找的元素的父节点(虽然它实际上不是文档根的子节点)
XML:
<root>
<item key="a">
<item key="b">
<item key="c">
<item key="d"/>
</item>
</item>
<item key="e">
<item key="f">
<item key="g"/>
</item>
</item>
</item>
</root>
Run Code Online (Sandbox Code Playgroud)
实际的XML更深入,分支更多.
因此,例如,如果我使用key = g,e或f在项目上,我需要使用key = e返回项目.如果我在带有键b,c或d的项目上,我需要使用key = b返回项目.
我正在使用这个xpath,它正在工作,但是上升然后回到祖先 - 后代轴似乎比我需要的旅程更长.
current()
/ancestor-or-self::item[@key='a']
/item[descendant-or-self::* = current()]
Run Code Online (Sandbox Code Playgroud)
是否有一种更简单的方法,记住我只知道1)我所在的节点和2)我正在寻找的节点的父节点的键属性?
仅仅是为了细节:XML是Sitecore生成的,我实际上并没有使用current()函数,我正在使用sc_currentitem参数来设置我需要开始处理的起始节点.
提前致谢.
sitecore ×5
android ×2
alarmmanager ×1
iframe ×1
pipeline ×1
quirks-mode ×1
rendering ×1
xpath ×1
xslt ×1