我有一个有父母和儿童属性的课程.
ADO.NET实体框架分层页面类http://img148.imageshack.us/img148/6802/edmxxe8.gif
我想在WPF树视图中显示此层次结构.
这是我的XAML ......
<TreeView Margin="12" Name="TreeViewPages" ItemsSource="{Binding}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<TextBlock Text="{Binding Path=ShortTitle}" />
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
Run Code Online (Sandbox Code Playgroud)
我的VB代码......
Dim db As New PageEntities
Dim t = From p In db.Page.Include("Children") _
Where p.Parent Is Nothing _
Select p
TreeViewPages.ItemsSource = t
但后来我只得到了两层深的树.为了让这个工作,我需要做什么?
我一直在尝试让我的WPF应用程序提示用户丢弃未保存的更改,或者在使用TreeView导航时取消.
我想我发现了一个错误.MessageBox与PreviewMouseDown不兼容.它似乎"处理"了一个点击,无论如何显示一个MessageBox,它的e.Handled是如何设置的.
对于这个XAML ......
<TreeView Name="TreeViewThings"
...
PreviewMouseDown="TreeViewThings_PreviewMouseDown"
TreeViewItem.Expanded="TreeViewThings_Expanded"
TreeViewItem.Selected="TreeViewThings_Selected" >
Run Code Online (Sandbox Code Playgroud)
...比较这些替代方法......
Sub TreeViewNodes_PreviewMouseDown(...)
e.Handled = False
End Sub
Sub TreeViewNodes_PreviewMouseDown(...)
MessageBox.Show("Test", "Test", MessageBoxButton.OK)
e.Handled = False
End Sub
这两种方法表现不同.没有MessageBox,TreeViewNodes_Selected()或者TreeViewThings_Expanded()会执行.使用MessageBox,他们不会.
这是一个错误还是在这里发生了一些我应该理解的事情?
我的View aspx文件中有很多这些错误.
但是,它构建并运行得很好.
这些是什么?我怎么摆脱他们?
我在WPF项目中有一个名为Node的ADO.NET Entity Framework类.我想在同一解决方案中的不同ASP.NET MVC项目中使用它.
我的节点控制器:
Public Class NodeController
Inherits System.Web.Mvc.Controller
Function Display(ByVal id As Guid) As ActionResult
Dim db As New WpfApplication1.Model1Entities
Dim m As WpfApplication1.Node = (From n In db.Node _
Where n.Id = id _
Select n).First
Return View(m)
End Function
End Class
当我运行项目并尝试导航到 http://.../Node/Display/[a valid ID]
我的显示操作出错:
'/'应用程序中的服务器错误.
编译错误
编译器错误消息:BC30456:'Title'不是'ASP.views_node_display_aspx'的成员.
来源错误:
第1行:<%@ Page Title =""Language ="VB"MasterPageFile ="〜/ Views/Shared/Site.Master"Inherits ="System.Web.Mvc.ViewPage(Of WpfApplication1.Node)"%>
源文件:C:...\MvcApplication1\Views\Node\Display.aspx
我读过这个错误可能是由于代码隐藏类命名冲突造成的.但我认为这不是这种情况.
我是否可以不使用其他项目中的模型来创建强类型的ASP.NET MVC视图?
我已尝试在Display.aspx页面上导入命名空间,但没有
<%@ Import Namespace="WpfApplication1" %>
Run Code Online (Sandbox Code Playgroud)
要么
<%@ Import Namespace="SolutionName.WpfApplication1" %> …Run Code Online (Sandbox Code Playgroud) 这是我在Global.asax.vb中尝试做的事情:
Public Class MvcApplication
Inherits System.Web.HttpApplication
Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
routes.MapRoute( _
"Error", _
"error.html", _
New With {.controller = "Error", _
.action = "FriendlyError"} _
)
...
'other routes go here'
...
End Sub
Sub Application_Start()
RegisterRoutes(RouteTable.Routes)
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
...
'code here logs the unhandled exception and sends an email alert'
...
Server.Transfer("http://www.example.com/error.html")
End Sub
End Class
Run Code Online (Sandbox Code Playgroud)
但是Server.Transfer失败了:
Invalid path for child request 'http://www.example.com/error.html'. A virtual path …
我的记录显示我的网站的特定页面在7月2日到11月15日期间被访问了609次.
Google Analytics在此期间仅报告238次网页浏览量.
我无法解释这种差异.
要让Google Analytics跟踪网页浏览事件,客户端浏览器必须启用JavaScript并能够访问Google的服务器.我怀疑60%的访问者已禁用JavaScript或防火墙到Google的跟踪服务器的出站流量.
你有什么解释吗?
我的应用程序只是将记录放入数据库中,因为它提供了一个页面.
它没有做任何事情来区分机器人观察者和人类.
我已经创建并填充了一个通用的字符串列表,如下所示:
Dim MyList As New List(Of String)
MyList.Add("Beta")
MyList.Add("Echo")
MyList.Add("Charlie")
MyList.Add("Alpha")
MyList.Add("Delta")
Run Code Online (Sandbox Code Playgroud)
现在我想订购它.
我想简单地在字段中按下Enter键,<input>或者替换Tab键按下.我还没决定哪个最好.
我怎么能在jQuery中做到这一点?到目前为止我有这个:
$(document).ready(function(){
...
//handle enter key
$("input").keypress(function (e) {
var k = e.keyCode || e.which;
if (k == 13) {
//???
}
});
});
Run Code Online (Sandbox Code Playgroud)
(这个问题e.keyCode || e.which推荐给那部分.)
我可以放在哪里(a)取消事件或者(b)强制按Tab键?
我有三个网站,每个网站都有自己的域名转到我的一个Windows Server 2008 IIS 7.0 Web服务器.
example1.comexample2.comexample3.com每个站点绑定:
IIS 7.0站点绑定example1.com http://img371.imageshack.us/img371/4215/example1pf4.gif
IIS 7.0站点绑定example2.com http://img371.imageshack.us/img371/2567/example2xx0.gif
IIS 7.0站点绑定example3.com http://img266.imageshack.us/img266/8186/example3rh9.gif
当我导航到example1.com,然后我看到我的example1网站.
当我导航到example2.com,然后我看到我的example2网站.
但是,当我导航到时example3.com,我看到我的example1网站 - 而不是我期望的example3网站.
这是怎么回事?为什么可能example2.com有效,但example3.com失败了?
问题解决了!
我删除了然后在IIS中重新创建了example3.com网站,它现在正在运行.
我什么都没改变.它最初有一个简单的拼写错误或重新创建它的行为恰好在IIS中解决了打嗝.
在IIS中设置其他重定向后,它再次停止工作,强制网站使用子域:
http://example1.com/ 重定向到 http://www.example1.com/
我再次删除然后重新创建example3.com网站; 我重置了IIS; 我重新启动了服务器.它仍然无法正常工作.
我已经明白了.这不是IIS问题.这是一个DNS问题.
由于example3.com某种原因,流量被定向到不同公司的Web服务器.他们提供一个只有HTML框架的页面.该框架加载带有地址的页面http://example3.example1.com.这就是我需要在MY Web服务器上处理的内容.
我需要创建几个共享Microsoft SQL Server数据库的应用程序.这些包括ASP.NET Web应用程序,WPF桌面应用程序,以及可能奇怪的控制台应用程序.
我想使用ADO.NET实体框架进行数据访问,为我的业务逻辑扩展其对象,并将这些对象绑定到我的UI中的控件.
如何在我的每个应用程序中执行此操作而不会重复太多?如果数据库模式或我的业务逻辑发生了变化,那么我想要一种简单(或自动)方式来更新我的所有应用程序.
我应该如何构建这个系统?
更新:我问过后续问题......
.net ×4
asp.net-mvc ×3
wpf ×2
architecture ×1
asp.net ×1
binding ×1
collections ×1
data-binding ×1
dns ×1
events ×1
exception ×1
forms ×1
global-asax ×1
hosting ×1
iis ×1
iis-7 ×1
jquery ×1
keypress ×1
linq ×1
list ×1
messagebox ×1
submit ×1
vb.net ×1
wcf ×1
web-services ×1