小编tr3*_*r3v的帖子

Internet Explorer 8和jquery addEventListener

我最近将我的MVC 4应用程序从VS2010迁移到VS2012.一旦一切正常,我也从.Net 4.0迁移到.Net 4.5,我将NuGet包升级到最新的稳定版本.

一切似乎工作正常,但我现在已被告知该应用程序无法使用IE8(也不是IE7),虽然每个其他浏览器似乎没问题.

出现以下错误: -

SCRIPT438:Object不支持属性或方法'addEventListener'jquery-2.0.3.js,第834行字符4

生成的HTML如下所示: -

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8" />
    <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="width=device-width" />
    <link href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/esri/css/esri.css" rel="stylesheet"/>
    <link href="/Content/site.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.core.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.resizable.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.selectable.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.accordion.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.autocomplete.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.button.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.dialog.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.slider.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.tabs.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.datepicker.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.progressbar.css" rel="stylesheet"/>
    <link href="/Content/themes/base/jquery.ui.theme.css" rel="stylesheet"/>
    <link href="/Content/menubar.css" rel="stylesheet"/>
    <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.2compact"></script>
    <script src="/Scripts/jquery-2.0.3.js"></script>
    <script src="/Scripts/jquery-ui-1.10.3.js"></script>
    <script …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc jquery addeventlistener internet-explorer-8

6
推荐指数
1
解决办法
5464
查看次数

如何从视图向控制器发送所选复选框的列表

我一直试图找出如何使用ActionLink获取所选复选框的列表.我想我需要使用JavaScript做一些客户端但无法找到相关代码.

以下代码使用提交按钮完美地工作,将选定的id作为id的数组回发,但我需要在具有其他按钮的页面上进行此操作.

// the view 
@foreach (var station in Stations)
{
   <input type="checkbox" name="selected" value="@station.StationId" /> 
}    
<input type="submit" value="Save" />

//Controller stub
public ActionResult Action(string [] selected) 
Run Code Online (Sandbox Code Playgroud)

我被困在这几个小时,所以也许我正在以错误的方式看待这个.

PS.经过几个小时的阅读和学习后,我的第一篇文章.

html asp.net-mvc

5
推荐指数
1
解决办法
1万
查看次数

为什么HTTP图像不出现在HTTPS应用程序中?

我已经安全(HTTPS)使用不安全(HTTP)ArcGIS地图服务的ASP.Net MVC 4应用程序.使用JavaScript调用这些服务以获取相关的地图图像.

如果我为我的应用程序使用HTTP,一切都按预期工作.但是,如果我使用HTTPS,IE10和Chrome不显示请求的地图图像(IE提示显示不安全的内容),但Safari显示图像,没有问题.

作为一个例子,说我的应用是HTTPS://app.mydomain.com和我的地图服务是在HTTP://gis.mydomain.com

我运行fiddler并看到响应类似(删除了一些参数以简化):http://gis.mydomain.com/arcgis/rest/services/Energy/BaseService/MapServer/export?....&f = image但图像未显示.如果我将此URL直接输入我的地址栏,则会显示预期的图像.

任何地方都没有报告错误,包括IIS 7.5日志.我意识到混合内容并不理想,但目前我没有选择.关于这类问题,我发现了很多关于SilverLight的引用,但我只使用了javascript和ASP.Net.我还比较了https和http的页面源 - 没有区别.

javascript asp.net https image arcgis

3
推荐指数
1
解决办法
2208
查看次数

将表连接结果传递给视图?

我有以下ASP.Net MVC控制器动作,它连接2个表: -

public ActionResult PersonNotes()
{
    var model = db.Notes
        .Join(db.People, p => p.NotesListId, n => n.NotesListId, 
            ((note, person) => new { note, person })).ToList();
    return View(model);
}
Run Code Online (Sandbox Code Playgroud)

在我看来,我有以下模型声明: -

@model IEnumerable<Tuple<Models.Note, Models.Person>>
Run Code Online (Sandbox Code Playgroud)

我收到以下错误: -

System.InvalidOperationException: The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[<>f__AnonymousTypef`2[Models.Note,Models.Person]]', but this dictionary requires a model item of type System.Collections.Generic.IEnumerable`1[System.Tuple`2[Models.Note,Models.Person]]'.
Run Code Online (Sandbox Code Playgroud)

我意识到我可以在我的连接中使用ViewModel和Select(),但只需访问所有项目而不必创建ViewModel会更方便.

在我看来,正确的声明是什么,或者我试图通过这种方式实现的是什么?

c# asp.net-mvc razor

0
推荐指数
1
解决办法
1822
查看次数