Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用jquery从数据库中检索值_C#_Javascript_Jquery - Fatal编程技术网

C# 使用jquery从数据库中检索值

C# 使用jquery从数据库中检索值,c#,javascript,jquery,C#,Javascript,Jquery,我需要从网格“FarmacoGrid”中提取数据“fechacadad”,将其存储在辅助变量“fechaCadAux”中。我尝试了几种不同的方法,但都没有成功 $(document).ready(function () { $("#FarmacoGrid").jqGrid({ url: '@Url.Action("Load", "Farmaco")', datatype: 'json', mtype: 'POST', autowidth: true, al

我需要从网格“FarmacoGrid”中提取数据“fechacadad”,将其存储在辅助变量“fechaCadAux”中。我尝试了几种不同的方法,但都没有成功

$(document).ready(function () {
$("#FarmacoGrid").jqGrid({
    url: '@Url.Action("Load", "Farmaco")',
    datatype: 'json',
    mtype: 'POST',
    autowidth: true,
    altRows: true,
    altclass: 'grid-alt-row',
    rowNum: @(ViewBag.PageSize * (ViewBag.PageIndex + 1)),
    colNames: ['NomFarmaco', 'Cantidad', 'FechaCaducidad', 'FechaPedido','FechaReposicion', '', '', '', ''],
    colModel: [
        { index: 'NomFarmaco', name: 'NomFarmaco', sortable: true, resizable: false },
        { index: 'Cantidad', name: 'Cantidad', sortable: true, resizable: false },
        { index: 'FechaCaducidad', name: 'FechaCaducidad', sortable: true, resizable: false },
        { index: 'FechaPedido', name: 'FechaPedido', sortable: true, resizable: false },
        { index: 'FechaReposicion', name: 'FechaReposicion', sortable: true, resizable: false },
        { name: 'imagen', sortable: false, classes: 'grid-cell-imagen', resizable: false },
        { name: 'fechaCadAux', sortable: false, classes: 'grid-cell-fechaCadAux', resizable: false },
        { name: 'fechaHoyAux', sortable: false, classes: 'grid-cell-fechaHoyAux', resizable: false },
        { name: 'edit', sortable: false, classes: 'grid-cell-edit', resizable: false },         
    ],
    gridComplete: 
        function(){ 
            var ids = jQuery("#FarmacoGrid").jqGrid('getDataIDs'); 
            for(var i=0;i < ids.length;i++)
            { 
                var rowId = ids[i];
                var fechaCadAux = $("#FarmacoGrid"+FechaCaducidad).val();
                var fechaHoyAux = Date.parse(new Date());
                var imagenHtml = imagenHtml = '<img src="@Url.Content("~/Content/Images/verde.png")"/>';
                var editHtml = '<a href="@Url.Action("Edit", "Farmaco")/' + rowId + '" title="@Resources.Shared.Edit"><img src="@Url.Content("~/Content/Images/CRUD/edit.png")"/></a>';
                var deleteHtml = '<a href="#" onclick="return DeleteGridItem(\'FarmacoGrid\', \'@Url.Action("Delete", "Farmaco")\', \'' + rowId + '\')" title="@Resources.Shared.Delete"><img src="@Url.Content("~/Content/Images/CRUD/delete.png")"/></a>';
                $("#FarmacoGrid").jqGrid('setRowData', ids[i], { imagen: imagenHtml, "fechaCadAux": fechaCadAux, "fechaHoyAux": fechaHoyAux, "edit": editHtml, "delete": deleteHtml}); 
            }
$(文档).ready(函数(){
$(“#FarmacoGrid”).jqGrid({
url:'@url.Action(“加载”、“Farmaco”),
数据类型:“json”,
mtype:“POST”,
自动宽度:正确,
阿尔特罗斯:是的,
altclass:“网格alt行”,
rowNum:@(ViewBag.PageSize*(ViewBag.PageIndex+1)),
colNames:['NomFarmaco'、'Cantidad'、'FechaCaducidad'、'FechaPedido'、'FechaReposicion'、''、''、''、''、''、''、'],
colModel:[
{索引:'NomFarmaco',名称:'NomFarmaco',可排序:true,可调整大小:false},
{索引:'Cantidad',名称:'Cantidad',可排序:true,可调整大小:false},
{索引:'fechacadad',名称:'FechaCaducidad',可排序:true,可调整大小:false},
{索引:'FechaPedido',名称:'FechaPedido',可排序:true,可调整大小:false},
{索引:'fechareposcion',名称:'fechareposcion',可排序:true,可调整大小:false},
{name:'imagen',可排序:false,class:'grid cell imagen',可调整大小:false},
{name:'fechaCadAux',可排序:false,class:'grid cell fechaCadAux',可调整大小:false},
{name:'fechaHoyAux',可排序:false,class:'grid cell fechaHoyAux',可调整大小:false},
{name:'edit',sortable:false,classes:'grid cell edit',resizeable:false},
],
gridComplete:
函数(){
var id=jQuery(“#FarmacoGrid”).jqGrid('getdataid');
对于(变量i=0;i
我自己的问题的解决方案是:

var fechaCadAux = jQuery("#FarmacoGrid").jqGrid('getRowData',rowId).FechaCaducidad;