小编imd*_*sen的帖子

如何获得JSON密钥和价值?

我编写了以下代码来从webservice获取JSON结果.

function SaveUploadedDataInDB(fileName) {
            $.ajax({
                type: "POST",
                url: "SaveData.asmx/SaveFileData",
                data: "{'FileName':'" + fileName + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    var result = jQuery.parseJSON(response.d);
                    //I would like to print KEY and VALUE here.. for example
                    console.log(key+ ':' + value)
                    //Addess : D-14 and so on..
                   }
            });
        }
Run Code Online (Sandbox Code Playgroud)

以下是来自webservice的回复: 在此输入图像描述

请帮我打印Key和它的价值

asp.net jquery json

47
推荐指数
3
解决办法
16万
查看次数

在IOS 6.0或iPhone上传时,捕获的照片会自动旋转

我有一个HTML文件控件使用这个我试图在服务器上传文件.

  • 单击文件控件
  • 它将自动打开文件/摄像机选择对话框.
  • 我选择相机
  • 我拍摄照片并保存
  • 现在提交表格
  • Capture照片在服务器上成功保存但旋转90度.

此问题仅适用于iPhone或IOS.

<input id="image" name="image" type="file" accept="image/*" capture style="width: 58px" />
Run Code Online (Sandbox Code Playgroud)

请告诉我,如果从相机捕获图像,如何停止自动旋转图像.

谢谢,Imdadhusen

file-upload image form-submit ios

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

如何从Controller设置@ Html.ActionLink的动态标题?

我有

@Html.ActionLink("Remove 1034, 1035, 1036", "RemoveSelected")
Run Code Online (Sandbox Code Playgroud)

现在我想从Controller设置每个id

例如:

@Html.ActionLink(ViewBag.RemoveSelectedTitle, "RemoveSelected") //this is not work

// GET: /TabMaster/
        public ActionResult Index()
        {
            ViewBag.RemoveSelectedTitle = "100,101,102";
            return View(_tabmasterService.GetTabMasterList(10, 1));
        }
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc dynamic html.actionlink viewbag

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

如何在Web中为管理员登录提供仅ELMAH.axd的Access

我已经创建了应用程序并实现了ELMAH日志记录.在我的网站中有三种类型的用户.

  • 管理员:可以一切(查看elamh.axd的权利)
  • 用户 :可以拥有自己的权限(无法查看elamh.axd)
  • 访客:仅查看(无法查看elamh.axd)
  • 以上用户将存储在数据库中.

    Probelm: - 现在我如何管理User和Guest的保护级别以查看ELMAH.axd日志文件?

    elmah asp.net-mvc-3

    7
    推荐指数
    1
    解决办法
    3172
    查看次数

    无法返回JsonResult

    以下查询已成功运行.

    var tabs = (
                    from r in db.TabMasters
                    orderby r.colID
                    select new { r.colID, r.FirstName, r.LastName })
                    .Skip(rows * (page - 1)).Take(rows);
    
    Run Code Online (Sandbox Code Playgroud)

    现在我想要返回JsonResult

    var jsonData = new
                {
                    total = (int)Math.Ceiling((float)totalRecords / (float)rows),
                    page = page,
                    records = totalRecords,
                    rows = (from r in tabs
                            select new { id = r.colID, cell = new string[] { r.FirstName, r.LastName } }).ToArray()
                };
    return Json(jsonData, JsonRequestBehavior.AllowGet);
    
    Run Code Online (Sandbox Code Playgroud)

    但它会给我一个错误: 数组类型'System.String []'无法在查询结果中初始化.请考虑使用'System.Collections.Generic.List`1 [System.String]'.

    我该怎么做才能得到预期的结果?

    linq asp.net asp.net-mvc-3

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

    将默认消息"正在加载..."替换为JQGrid页脚上的图像"Loading.gif"

    专家介绍,

    我在我的项目上成功实现了JQGrid.我的要求是我想在jqgrid页脚将图像"Loading.gif"替换为默认消息"Loading ...".

    这有可能实现吗?

    我还附加了屏幕截图以获得更清晰.

    在此输入图像描述

    更新了JQGrid页脚HTML
    在此输入图像描述

    谢谢,
    Imdadhusen

    jquery jqgrid

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

    使用SignalR 2和MVC 4.0将服务器发送到特定客户端的消息无效

    我想使用signalR从服务器调用通知特定客户端,但它无法正常工作.我的代码执行成功但客户端没有收到来自服务器的任何调用.

    然而,这适用于所有客户.

    var hubContext = GlobalHost.ConnectionManager.GetHubContext<ProcessStatusNotifyHub>();
    hubContext.Clients.All.notify("Got it!");
    
    Run Code Online (Sandbox Code Playgroud)

    但这不适用于特定客户端 [更新代码] 以下代码用chat.cshtml编写

    $(function () {
           // Reference the auto-generated proxy for the hub.
           var chat = $.connection.processStatusNotifyHub;//chatHub;
           chat.client.notify = function (msg) {
                alert(msg);
           }
           // Start the connection.
           $.connection.hub.start().done(function () {
               var myClientId = $.connection.hub.id;
               console.log('connected: ' + myClientId);
               $('#sendmessageToClient').click(function () {
                    //chat.server.send('imdadhusen', 'This is test text');
                    $.ajax({
                            url: '@Url.Action("Send", "PushNotification")',
                            type: 'POST',
                            data: { 'clientID': myClientId },
                            dataType: 'json',
                            success: function (result) {
                                alert(result.status);
                     }
                  });
               });
           });
    });
    
    Run Code Online (Sandbox Code Playgroud)

    以下代码写在Controller中 …

    c# asp.net-mvc-4 signalr

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

    根据纬度和经度列表计算的中心点与实际略有不同

    我正在使用 C# 计算可用纬度/经度列表的中心纬度/经度并在 OpenLayer 地图上渲染。

    我观察到获取中心 lat/lng 的计算会给我带来 lat/lng 的轻微差异。我参考此链接进行计算计算 多个纬度/经度坐标对的中心点

    C# 代码:

    static void Main(string[] args)
            {
                List<GeoCoordinate> listCoordinate = new List<GeoCoordinate>();
                listCoordinate.Add(new GeoCoordinate() { Latitude = 22.9833, Longitude = 72.5000 }); //Sarkhej
                listCoordinate.Add(new GeoCoordinate() { Latitude = 18.9750, Longitude = 72.8258 }); //Mumbai
                listCoordinate.Add(new GeoCoordinate() { Latitude = 22.3000, Longitude = 73.2003 }); //Vadodara
                listCoordinate.Add(new GeoCoordinate() { Latitude = 26.9260, Longitude = 75.8235 }); //Jaipur
                listCoordinate.Add(new GeoCoordinate() { Latitude = 28.6100, Longitude = 77.2300 }); //Delhi …
    Run Code Online (Sandbox Code Playgroud)

    c# geocoding latitude-longitude openlayers

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

    如何在Windows应用程序中为DataGridView创建EmptyDataText

    今天我面临着根据数据源显示/隐藏标签的问题.如果数据源没有行,那么我想设置"No Data Found",否则显示winforms应用程序中的记录数.

    这可以在Asp.net中像:

    <emptydatatemplate>
    No Data Found
    </emptydatatemplate>
    
    Run Code Online (Sandbox Code Playgroud)

    要么

    EmptyDataText=" No Data Found"
    
    Run Code Online (Sandbox Code Playgroud)

    但我想在Windows应用程序中.如果您有相同的解决方案,请帮助我.

    任何解决方案将不胜感激!谢谢,Imdadhusen

    datagridview custom-controls winforms

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

    为什么JQuery模态对话框和JQGrid模态对话框看起来有所不同?

    我用Jquery模式对话框为Delete创建了JQGrid.如果我把它留空并且按下提交它将弹出消息请输入名字但是问题是Inbuilt Popup消息和我的jquery模式对话框看起来太不同了,需要内联编辑和一个字段的Jqgrid.

    内置JQGrid模态对话框:
    在此输入图像描述

    JQuery模态对话框
    在此输入图像描述

    码:

    function createGrid() {
            jQuery("#list").jqGrid({
                url: '@Url.Action("JQGridGetGridData", "TabMaster")',
                datatype: 'json',
                mtype: 'GET',
                colNames: ['col ID', 'First Name', 'Last Name', ''],
                colModel: [{ name: 'colID', index: 'colID', width: 100, align: 'left', searchoptions: { sopt: ['eq', 'ne', 'cn']} },
                          { name: 'FirstName', index: 'FirstName', width: 150, align: 'left', editable: true, editrules: { required: true} },
                          { name: 'LastName', index: 'LastName', width: 150, align: 'left', editable: true, editrules: { required: true} },
                          { name: 'act', index: 'act', width: 60, …
    Run Code Online (Sandbox Code Playgroud)

    jquery modal-dialog jqgrid

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