如何转换ASP.NET会话以取回列表?(How do I cast a ASP.NET session to get back my list?)
背景:我有两个网页,一个是事物列表,另一个是事物的细节。 在列表中,用户可以进行筛选和排序,从而生成排序列表。 在细节上,我希望用户具有Next和Previous导航。
我正在使用带有Razor的ASP.Net网页,使用WebMatrix或Visual Studio进行编辑。 列表页面上的代码很简单。 RefID是一个整数Key唯一标识记录:
var db = Database.Open("dbname"); ... var q = db.Query( sqlthatworks , passInVarables); Session["WorkingList"] = q.Select( x => new { x.RefID } );
在详细信息页面上,我需要能够访问Session [“WorkingList”],以便我可以使用此StackOverFLow问题提供的Linq来查找下一个和之前的记录 ,这些记录将类似于:
var workingList = (IEnumerable<dynamic>) Session["WorkingList"]; var nextRecord = workingList.SkipWhile(i => i.RefID != currentRecord).Skip(1).First();
我知道db.Query返回一个IEnumerable <Object> ,但我猜测真正回归的是IEnumerable <dynamic>。 这有效,但似乎过于复杂。 有没有更好的办法?
Background: I have two web pages, one is a list of things, and the other is the detail of the thing. On the list, the user can filter and sort, which results in a sorted list. On the details, I would like the user to have Next and Previous navigation.
I'm using ASP.Net Web Pages with Razor, edited with either WebMatrix or Visual Studio. The code on the list page is simple. The RefID is an integer Key uniquely identify the record:
var db = Database.Open("dbname"); ... var q = db.Query( sqlthatworks , passInVarables); Session["WorkingList"] = q.Select( x => new { x.RefID } );
On the details page, I need to be able to access the Session["WorkingList"] such that I can use the Linq provided by this StackOverFLow question to find the next and previous records, which will be something like:
var workingList = (IEnumerable<dynamic>) Session["WorkingList"]; var nextRecord = workingList.SkipWhile(i => i.RefID != currentRecord).Skip(1).First();
I know that db.Query returns a IEnumerable< Object>, but I'm guessing what's really coming back is a IEnumerable< dynamic >. And that works, but seems overly complicated. Is there a better way?
原文:https://stackoverflow.com/questions/8490435
最满意答案
截图应该保存在桌面上。
The screenshot should be saved on the Desktop.
相关问答
更多-
在问我问题六分钟后,我想出了答案。 当鼠标悬停在“截图”按钮上时,会弹出一个提示框。 屏幕截图会直接保存到桌面,您将看到它们以文件名格式“ Screen Shot YYYY-MM-DD at HH.mm.ss AM/PM.png ”保存。 Six minutes after asking my question I figured out the answer. There's a tooltip that pops up when hovering over the "Take Screenshot" b ...
-
截图应该保存在桌面上。 The screenshot should be saved on the Desktop.
-
在您的项目构建设置下 选择部署部分 将iOS部署目标更改为iOS 5.0或更低版本 现在您可以继续将部署目标从设备更改为模拟器! 在我的情况下,部署目标设置为5.1版,我仍然在运行雪leapord操作系统,并从xcode 4.3复制适当的JARS,使其运行于运行iOS 5.1的设备。 但是,我的模拟器还没有支持5.1版本,所以我将部署目标更改为较低版本,例如5.0或4.2,它不会让我在模拟器上运行。 Under Your project Build Settings select Deployment se ...
-
有时候我会使用一个相当丑陋的黑客来做到这一点。 当您在模拟位置时将设备连接到Xcode时,只需移除照明电缆而不直接杀死应用程序。 该应用程序将崩溃,但当您重新启动它时,您将看到它显示相同的模拟位置,尽管它不再连接到Xcode。 请注意,这不是一种优雅的方法 ,为了使您的设备位置服务再次正常工作,您必须在设备上运行Xcode中的应用并明确设置Debug/Simulate Location/Don't Simulate Location Sometimes I use a quite ugly hack to ...
-
它只是说“iPhone”,因为你的iPhone的名字是“iPhone”。 所以你的iPhone在设备列表中,我认为你可以正常构建和运行应用程序。 检查iPhone的设置以确保设备名称。 It just says "iPhone" because name of your iPhone is "iPhone". So your iPhone is in list of devices, I think you can build and run the application as normal. Check ...
-
附加实际设备进行调试时: 该设备将继承调试>模拟位置下的位置调试设置。 如果将此设置为“不模拟位置”,则附加设备将使用GPS / WiFi(如果设备有能力)返回的实际位置。 如果您选择任何其他设置(位置),则连接的设备将不会使用它的真实位置,而会模拟所选的位置。 如果您在产品>架构>编辑架构下禁用核心位置“允许位置模拟”,您将无法模拟首次亮相的位置,但是如果连接的设备支持位置,则将使用真实的设备位置。 When you attach a real device for debugging: The devi ...
-
Xcode符号文件位置(Xcode symbol file location)[2023-11-06]
确保在启用调试标志的情况下构建应用程序。 该文件应位于您的库文件夹中: ~/Library/Developer/Xcode/DerivedData//Build/Products/Debug-iphoneos 在此文件夹中,将有一个.dSYM包文件夹,其中包含Contents/Resources/中的符号文件。 您还可以通过在二进制文件/库上运行dsymutil来生成.dSYM软件包文件。 Ensure that your application is built ... -
在xcode 4中设置不需要此设置,因为它会自动设置位置。 来自这个论坛帖子 : 您不再需要在Xcode 4中执行此操作; 它自动将构建产品与〜/ Library / Developer / Xcode / DerivedData中的每个工作区隔离开来。 相反,您需要使用适当的项目作为成员(以及您的其他应用程序/框架目标)创建工作区。 如果您查看其中一个iOS示例应用程序,您应该能够打开它并构建(因为那些已经有框架的项目引用,Xcode 4跟随示例)。 查看此doc以获取特定的项目/工作区构建设置: htt ...
-
我想到了。 它涉及将屏幕截图保存为UIImage,然后使用此处的非常有用的教程让我进行PDF转换。 事实证明,有一些功能可以处理Core Graphics类中PDF文档的制作。 I figured it out. It involved saving a screenshot as a UIImage, and then using the very helpful tutorial found here to get me going with the PDF conversion. As it turn ...
-
我只是尝试重启XCode并多次运行/停止应用程序,然后复选框神奇地出现了。 无论如何,我还向Apple发射了雷达。 I just tried restarting XCode and running/stopping the app several times, then the checkbox magically appeared. I've also fired a radar to Apple anyway.