我的公司有一个用ASP.NET构建的网站,目标是.NET 3.5.它过于庞大和庞大,无法及时转换为.NET 4.我的任务是建立一个票务系统.我希望这个票务系统与主应用程序完全独立.我在网站上添加了一个名为"TicketingSystem"的目录,然后在IIS中我使用面向.net 4.0的应用程序池将此文件夹设置为应用程序.我假设这个应用程序不会受到它上面的应用程序的影响,特别是因为它使用自己的应用程序池,但似乎它会以某种方式受到影响.使用我的.net 4 Web应用程序导航到此目录会生成此错误:
http://www.chevtek.com/content/error.jpg
我介绍了文件路径和内容等敏感信息,但是说配置文件的行有父应用程序配置文件的路径,而不是.net 4应用程序的配置文件.
任何信息表示赞赏.是不是可以在.net 3.5应用程序中嵌套.net 4.0应用程序?
编辑这里要求的是IIS目录结构的屏幕截图.
我的页面上有一个自定义验证器,用于文件上传控制.
<asp:FileUpload ID="fuVendorBrief" runat="server" />
<br />
<asp:CustomValidator ID="cvVendorBriefFile" Display="Dynamic" runat="server" ValidationGroup="EditorValidate" ControlToValidate="fuVendorBrief" OnServerValidate="cvVendorBriefFile_ServerValidate" ErrorMessage="You must upload a vendor brief PDF file.">
</asp:CustomValidator>
Run Code Online (Sandbox Code Playgroud)
然后我还有一个按钮.
<asp:Button ID="btnSubmit" ValidationGroup="EditorValidate" OnClick="btnSubmit_Click" runat="server" Text="Add Vendor Brief" />
Run Code Online (Sandbox Code Playgroud)
我已经定义了我的自定义验证器事件......
protected void cvVendorBriefFile_ServerValidate(object source, ServerValidateEventArgs args)
{
CustomValidator fileUploadValidator = (CustomValidator)source;
FileUpload vendorBriefFileUpload = (FileUpload)fileUploadValidator.Parent.FindControl(fileUploadValidator.ControlToValidate);
args.IsValid = vendorBriefFileUpload.HasFile && vendorBriefFileUpload.FileName.ToLower().EndsWith(".pdf");
}
Run Code Online (Sandbox Code Playgroud)
这个自定义验证器甚至没有被解雇.也许我只是累了,但是一切看起来都不错,所以我很欣赏这种见解.如果我在服务器验证事件中的任何地方删除断点,那么当我单击提交时它不会被点击.我可以在提交按钮的点击事件中点击断点.
有任何想法吗?
编辑 - 忘了在页面上提到我有其他验证控件,比如必需的字段验证器,它们可以正常启动.
编辑2 - 如果您想要页面的完整源代码及其代码隐藏,请遵循以下链接:
如果你看到任何奇怪的东西,请告诉我.我在这里半睡半醒,我希望我只是缺少一些愚蠢的东西.
我在ASP.NET项目中有一个小部件,我正在为我的工作开发.它必须是300像素宽,不能更宽.不幸的是,对于这样一个小小部件,他们想要的东西已经证明相当复杂.这就是我现在所拥有的:
http://www.codetunnel.com/content/images/widget/currentWidget.jpg
如您所见,这是一个jQuery UI手风琴控件.当每个折叠窗格展开时,会调用ajax来异步加载其内容.现在它会吐出一个包含所需数据的HTML表.该表在DIV中具有样式,overflow: auto;以便我们在底部和右侧获得滚动条.
我的问题是我想要一些漂亮的自定义功能(比如excel中的冻结窗格功能).当向左和向右滚动时,我希望所有行(包括标题)向左和向右滚动,除了最左边的列,"产品名称".像这样:
http://www.codetunnel.com/content/images/widget/scrollRight.jpg
向上和向下滚动时,我希望所有列(包括左列)向上和向下滚动除标题行外.像这样:
http://www.codetunnel.com/content/images/widget/scrollDown.jpg
实现此功能的最佳方法是什么?或者有办法吗?
我设法使用一个名为gulp-insert的gulp插件完成我的任务,如下所示:
gulp.task('compile-js', function () {
// Minify and bundle client scripts.
var scripts = gulp.src([
srcDir + '/routes/**/*.js',
srcDir + '/shared/js/**/*.js'
])
// Sort angular files so the module definition appears
// first in the bundle.
.pipe(gulpAngularFilesort())
// Add angular dependency injection annotations before
// minifying the bundle.
.pipe(gulpNgAnnotate())
// Begin building source maps for easy debugging of the
// bundled code.
.pipe(gulpSourcemaps.init())
.pipe(gulpConcat('bundle.js'))
// Buffer the bundle.js file and replace the appConfig
// placeholder string with a …Run Code Online (Sandbox Code Playgroud) 我有一个显示评论列表的视图.它通过DisplayTemplate完成此操作.我所要做的就是这样@Html.DisplayFor(x => x.BlogPost.PostComments),所有的评论都适当地呈现.
页面底部有一个表单,用于添加新评论.此页面使用渐进增强功能.因此,如果禁用了javascript,则表单会像正常一样提交,将注释添加到数据库,然后重定向到呈现博客帖子的操作.但是,如果javascript可用,那么jQuery会劫持表单的提交并通过ajax发布帖子.好吧因为注释标记在显示模板中,我不知道如何从action方法返回它,以便jQuery可以将它放在页面上.
我知道如何使用部分视图执行此操作.我只是让action方法返回正确的局部视图,jquery会将响应附加到页面上的comment容器中.
在我删除我的显示模板以支持部分视图之前,是否有一种直接的方法,我缺少从控制器发回显示模板?
这是我的行动方法:
public ActionResult AddComment(PostComment postComment)
{
postComment.PostedDate = DateTime.Now;
postCommentRepo.AddPostComment(postComment);
postCommentRepo.SaveChanges();
if (Request.IsAjaxRequest())
return ???????
else
return RedirectToAction("BlogPost", new { Id = postComment.BlogPostID });
}
Run Code Online (Sandbox Code Playgroud)
当页面加载时,它不需要担心它,因为它以标准方式使用模板:
<div class="comments">
@Html.DisplayFor(x => x.BlogPost.BlogPostComments)
</div>
Run Code Online (Sandbox Code Playgroud)
我只想知道如何将一个利用显示模板的评论发送回jQuery.
我们正在我的公司运行一个webforms项目,我有一个HttpModule,我需要解决它的依赖关系.
我们使用Ninject.Web库来解析母版页,页面,用户控件,Web服务和HttpHandler的依赖关系.所有这些都有可以在Ninject.Web命名空间中继承的基类:
但是我无法找到HttpModuleBase.有一个NinjectHttpModule,但它不是一个基类,它是一个真正的模块,试图消除从页面和用户控件中的基类继承的需要,但它有一些错误,我们没有使用它.
在HttpModule中解决依赖关系的最佳方法是什么?
当我谷歌这个我在第一页提出这个问题-_-
当我在PowerShell中执行Git命令时,一切都很顺利,除了PowerShell控制台和NuGet控制台之间的一个细微差别." git push" 的输出显示在NuGet窗口中的红色错误文本中,但在PowerShell窗口中显示正常.
这是一段显示差异的视频." git push"在包管理器控制台中将其结果显示为错误.该操作有效,令人讨厌的是操作的输出显示为错误.
我们经常需要将带有由某个字符分隔的值的字符串转换为列表.我想编写一个通用扩展方法,将字符串转换为指定类型的列表.这是我到目前为止:
public static List<T> ToDelimitedList<T>(this string value, string delimiter)
{
if (value == null)
{
return new List<T>();
}
var output = value.Split(new string[] { delimiter }, StringSplitOptions.RemoveEmptyEntries);
return output.Select(x => (T)x).ToList();
}
Run Code Online (Sandbox Code Playgroud)
但是我收到了一个错误.
无法将类型'string'转换为'T'类型.
有没有更好的方法来做到这一点,还是我需要为不同类型的列表创建多个扩展方法Convert.ToInt32(),等等?
我正在尝试做这样的事情:
var someStr = "123,4,56,78,100";
List<int> intList = someStr.ToDelimitedList<int>(",");
Run Code Online (Sandbox Code Playgroud)
要么
var someStr = "true;false;true;true;false";
List<bool> boolList = someStr.ToDelimitedList<bool>(";");
Run Code Online (Sandbox Code Playgroud) 我正在阅读这篇小文章,以了解继承EventEmitter,但我有点困惑.
他这样做:
function Door() {
events.EventEmitter.call(this);
this.open = function() {
this.emit('open');
};
}
Door.prototype.__proto__ = events.EventEmitter.prototype;
Run Code Online (Sandbox Code Playgroud)
https://gist.github.com/chevex/7646362
为什么他用自己的构造函数手动调用EventEmitter构造函数this?另外,为什么他将他的contsructor原型的原型设置为原型EventEmitter?这让我感到非常困惑.
然后评论中有人建议他这样做,这似乎更优雅:
function Door() {
events.EventEmitter.call(this);
this.open = function () {
this.emit('open');
}
}
util.inherits(Door, events.EventEmitter);
Run Code Online (Sandbox Code Playgroud)
https://gist.github.com/chevex/7646447
这看起来比其他方式干净,但这可能只是因为我无法理解第一次发生的事情.如果util.inherits与第一个例子做同样的事情,我不会感到惊讶.
第二个至少对我有点意义,但我仍然不明白他们为什么不这样做:
function Door() {
this.open = function () {
this.emit('open');
}
}
Door.prototype = new events.EventEmitter();
Run Code Online (Sandbox Code Playgroud)
https://gist.github.com/chevex/7646524
任何人都可以向我解释所有这些方法之间的区别是什么以及为什么在前两个方法中它们会.call(this)在EventEmitter构造函数上调用?我在尝试示例时省略了这一行,但仍然有效.
所以我知道EF实体跟踪他们自己的更改并在调用savechanges时将它们保存到数据库中,但是这个场景呢......
我有一个旨在编辑博客文章的页面.它有两种动作方法.
[HttpGet]
public ViewResult EditBlogPost(int Id)
{
//This action method gets the blog post by the id and returns the edit blog post page.
BlogPost blogPost = db.BlogPosts.Where(x => x.Id == Id).FirstOrDefault();
if (blogPost == null)
{
ViewData["message"] = "Blog post not found.";
return View("Result");
}
return View("ManageBlogPost", blogPost);
}
[HttpPost]
public ViewResult EditBlogPost(BlogPost blogPost)
{
//This one is where I'm having issues. When model binding populates blogPost, is it auto-tracking still? For some reason SaveChanges() doesn't seem to …Run Code Online (Sandbox Code Playgroud) c# asp.net-mvc entity-framework entity-framework-4 asp.net-mvc-2
c# ×6
asp.net ×4
javascript ×3
.net ×2
asp.net-mvc ×2
events ×2
jquery ×2
node.js ×2
webforms ×2
angularjs ×1
constructor ×1
git ×1
gulp ×1
html ×1
iis ×1
iis-7 ×1
linq ×1
list ×1
ninject ×1
nuget ×1
powershell ×1
prototype ×1
razor ×1
stream ×1
validation ×1