Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/17.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# 在大多数chrome版本和Firefox中,列宽是不同的_C#_Asp.net Mvc - Fatal编程技术网

C# 在大多数chrome版本和Firefox中,列宽是不同的

C# 在大多数chrome版本和Firefox中,列宽是不同的,c#,asp.net-mvc,C#,Asp.net Mvc,我用MVC编程,效果很好。但在一些chrome浏览器中,列的宽度是不同的。这是正确的桌子 你可以看到红色下划线,这是错误的 正如您所看到的,前三列比它们应该的宽 这是密码 <div class="col-md-9" style="background-color:gainsboro"> <table cellpadding="0" cellspacing="0" border="0" class=" display stripe row-border ord

我用MVC编程,效果很好。但在一些chrome浏览器中,列的宽度是不同的。这是正确的桌子

你可以看到红色下划线,这是错误的

正如您所看到的,前三列比它们应该的宽

这是密码

  <div class="col-md-9" style="background-color:gainsboro">

    <table cellpadding="0" cellspacing="0" border="0" class=" display stripe row-border  order-column"  id="example">
        <thead>
            <tr>
                 <th style="width:1%">fld_Id</th>
                <th style="width:1%">ref_Id</th>
                <th style="width:1%">Letter_Id</th>
                <th style="width:1%">Flags</th>
                <th style="width:1%">Status</th>
                <th style="width:1%">كد</th>
                <th style="width:1%">نوع</th>
                <th style="width:29%">ارجاع دهنده</th>
                <th style="width:30%">موضوع ارجاع</th>
                <th style="width:30%">موضوع نامه</th>
                <th style="width:1%">تاريخ دريافت</th>
                <th style="width:1%"></th>
                <th style="width:1%"></th>
                <th style="width:1%"></th>                   
            </tr>
        </thead>
        <tbody></tbody>           
    </table>

</div>

飞行识别码
参考号
字母识别码
旗帜
地位
كد
نوع
ارجاع دهنده
موضوع ارجاع
موضوع نامه
تاريخ دريافت
我使用的是MVC、Bootstrap v3.0.0、DataTable jquery。我怎样才能找到问题,使它们在不同的Borwser中看起来一样

编辑部分: 表中的数据将由DataTable Jquery服务器端填充。所以我制作了客户端数据表。结果正常,在不同的浏览器中没有差异。当我使用服务器端数据表时,会显示差异

这是我用来填充数据表的代码

 <script type="text/javascript">    

var BindDataTable = function (clicked_id) {             
    var table = $("#example").DataTable({
        "destroy": true,
        "bServerSide": true,
        "sAjaxSource": "/Main/GetLetterList",
        "fnServerData": function (sSource, aoData, fnCallback) {
            aoData.push({ "name": "fld_id", "value": boldMenu });
            $.ajax({                 
                type: "Get",
                data: aoData,
                url: sSource,
                dataType: "json",
                success: fnCallback,
                error: function (response) {

                        window.location.href = '/ACCLogin/Login/';
                }
            })

        },
        "fnDrawCallback": function () {
            var UnBoldMenu = "#" + $("#unBoldMenu").val();
            $("#ulTreeview").find(UnBoldMenu).css('font-weight', 'normal');
        },
        "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
            if (aData["Flags"] == "4") {
                $('td', nRow).css('font-weight', 'bold');
            }
            if (aData["Status"] == "1") {
                $('td', nRow).css('background-color', 'lightgreen');

            }
        },
        "aoColumns": [

            { "mData": "fld_Id" },
            { "mData": "ref_Id" },
            { "mData": "Letter_Id" },
            { "mData": "Flags" },
            { "mData": "Status" },
            { "mData": "ProjectCode" },
            { "mData": "LetterType" },
            { "mData": "Referrer" },
            { "mData": "Ref_subject" },
            { "mData": "Letter_subject" },
            { "mData": "Date_Received" },
            {
                "mData": "ref_Id",
                "render": function (ref_Id, aoData, type, full, meta) {
                    return '<a href="#" onclick="ViewLetter(' + ref_Id + ')" title="مشاهده نامه"><li class="glyphicon glyphicon-eye-open"></li></a>'
                }
            }, {
                "mData": "ref_Id",
                "render": function (ref_Id, type, full, meta) {
                    return '<a href="#" onclick="ReferenceLetter(' + ref_Id + ')" title="ارجاع نامه"><li class="glyphicon glyphicon-edit"></li></a>'
                }
            }
            , {
                "mData": "Letter_Id",
                "render": function (Letter_Id, type, full, meta) {
                    return '<a href="#" onclick="ReferenceList(' + Letter_Id + ')" title="گردش نامه"><li class="glyphicon glyphicon-retweet"></li></a>'
                }
            }

        ]
     })
        .columns.adjust();

    if (clicked_id!=-16)
        table.columns([0, 1, 2, 3, 4]).visible(false); 
    else
        table.columns([0, 1, 2, 3, 4,12]).visible(false); 


}


var ViewLetter = function (refId) {
        var url = "/Main/ViewLetter?Ref_Id=" + refId;
        $('body').css('cursor', 'wait');
        $("#myModalBodyDiv").load(url, function () {
            $("#myModal").modal("show");
        })
}

var ReferenceLetter = function (refId) {
    var url = "/Main/ReferenceLetter?Ref_Id=" + refId;
            $("#myModalBodyDivRefer").load(url, function () {
                $("#myModalRefer").modal("show");
        })
}


var ReferenceList = function (letterId) {
    var url = "/Main/ReferenceList?Letter_Id=" + letterId;
    $("#myModalBodyDivReferList").load(url, function () {
        $("#myModalReferList").modal("show");
    })
}



</script>

var BindDataTable=函数(单击的\u id){
var table=$(“#示例”).DataTable({
“毁灭”:真的,
“bServerSide”:正确,
“sAjaxSource”:“/Main/GetLetterList”,
“fnServerData”:函数(sSource、aoData、fnServerData回调){
推送({“name”:“fld_id”,“value”:boldMenu});
$.ajax({
键入:“获取”,
数据:aoData,
网址:sSource,
数据类型:“json”,
成功:,
错误:函数(响应){
window.location.href='/ACCLogin/Login/';
}
})
},
“fnDrawCallback”:函数(){
var UnBoldMenu=“#”+$(“#UnBoldMenu”).val();
$(“#ulTreeview”).find(未绑定菜单).css('font-weight','normal');
},
“fnRowCallback”:函数(nRow、aData、iDisplayIndex、iDisplayIndexFull){
如果(数据[“标志”]=“4”){
$('td',nRow).css('font-weight','bold');
}
如果(数据[“状态”]=“1”){
$('td',nRow).css('background-color','lightgreen');
}
},
“aoColumns”:[
{“mData”:“fld_Id”},
{“mData”:“ref_Id”},
{“mData”:“字母Id”},
{“mData”:“Flags”},
{“mData”:“Status”},
{“mData”:“ProjectCode”},
{“mData”:“LetterType”},
{“mData”:“referer”},
{“mData”:“Ref_subject”},
{“mData”:“字母主题”},
{“mData”:“收到日期”},
{
“mData”:“ref_Id”,
“render”:函数(ref_Id、aoData、type、full、meta){
返回“”
}
}, {
“mData”:“ref_Id”,
“渲染”:函数(参考Id、类型、完整、元){
返回“”
}
}
, {
“mData”:“字母Id”,
“呈现”:函数(字母、Id、类型、完整、元){
返回“”
}
}
]
})
.columns.adjust();
如果(单击\u id!=-16)
表.可见的列([0,1,2,3,4])(假);
其他的
表.可见的列([0,1,2,3,4,12])(假);
}
var ViewLetter=函数(refId){
var url=“/Main/ViewLetter?Ref_Id=“+refId;
$('body').css('cursor','wait');
$(“#myModalBodyDiv”).load(url,函数(){
$(#myModal”).modal(“show”);
})
}
var ReferenceLetter=函数(refId){
var url=“/Main/ReferenceLetter?Ref_Id=“+refId;
$(“#myModalBodyDivRefer”).load(url,函数(){
$(#mymodalrefere”).modal(“show”);
})
}
var ReferenceList=函数(letterId){
var url=“/Main/ReferenceList?Letter_Id=“+letterId;
$(“#myModalBodyDivReferList”).load(url,函数(){
$(#mymodalreferelist”).modal(“show”);
})
}

我在document.ready上调用BindDataTable

我从Jquery中设置每列的宽度,并将其从中删除。所以代码是这样的:

 <div class="col-md-9" style="background-color:gainsboro">

    <table cellpadding="0" cellspacing="0" border="0" class=" display stripe row-border  order-column"  id="example">
        <thead>
            <tr>
                <th>fld_Id</th>
                <th>ref_Id</th>
                <th>Letter_Id</th>
                <th>Flags</th>
                <th>Status</th>
                <th>كد</th>
                <th>نوع</th>
                <th>ارجاع دهنده</th>
                <th>موضوع ارجاع</th>
                <th>موضوع نامه</th>
                <th>تاريخ دريافت</th>
                <th></th>
                <th></th>
                <th></th>                    
            </tr>
        </thead>
        <tbody></tbody>           
    </table>

</div>
<script type="text/javascript">

var CategoryClick = function (clicked_id) {
    var boldMenu = $("#boldMenu").val();
    if  (boldMenu != clicked_id)
        $("#unBoldMenu").val(boldMenu);
    $("#boldMenu").val(clicked_id);
    var str = "#" + clicked_id;
    $("#ulTreeview").find(str).css('font-weight', 'bold');
    BindDataTable(clicked_id);
}

var BindDataTable = function (clicked_id) {  //response
    var boldMenu = $("#boldMenu").val();
     if (@User.Identity.Name=="" || @User.Identity.Name==null)
        window.location.href = '/ACCLogin/Login/';


    var table = $("#example").DataTable({
        "destroy": true,
        "bServerSide": true,
        "sAjaxSource": "/Main/GetLetterList",
        "fnServerData": function (sSource, aoData, fnCallback) {
            aoData.push({ "name": "fld_id", "value": boldMenu });
            $.ajax({
                type: "Get",
                data: aoData,
                url: sSource,
                dataType: "json",
                success: fnCallback,
                error: function (response) {
                        window.location.href = '/ACCLogin/Login/';
                }
            })

        },
        "fnDrawCallback": function () {
            var UnBoldMenu = "#" + $("#unBoldMenu").val();
            $("#ulTreeview").find(UnBoldMenu).css('font-weight', 'normal');
        },
        "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
            if (aData["Flags"] == "4") {
                $('td', nRow).css('font-weight', 'bold');
            }
            if (aData["Status"] == "1") {
                $('td', nRow).css('background-color', 'lightgreen');

            }
        },            
        "aoColumns": [

            {
                "mData": "fld_Id",
                "width": "1%"},
            {
                "mData": "ref_Id",
                "width": "1%" },
            {
                "mData": "Letter_Id",
                "width": "1%" },
            {
                "mData": "Flags",
                "width": "1%" },
            {
                "mData": "Status",
                "width": "1%" },
            {
                "mData": "ProjectCode",
                "width": "1%" },
            {
                "mData": "LetterType",
                "width": "1%" },
            {
                "mData": "Referrer",
                "width": "29%" },
            {
                "mData": "Ref_subject",
                "width": "30%" },
            {
                "mData": "Letter_subject",
                "width": "30%" },
            {
                "mData": "Date_Received",
                "width": "1%"  },                
            {
                "mData": "ref_Id",
                "width": "1%",
                "render": function (ref_Id, aoData, type, full, meta) {
                    return '<a href="#" onclick="ViewLetter(' + ref_Id + ')" title="مشاهده نامه"><i class="glyphicon glyphicon-eye-open"></li></a>'
                }
            }, {
                "mData": "ref_Id",
                "width": "1%",
                "render": function (ref_Id, type, full, meta) {
                    return '<a href="#" onclick="ReferenceLetter(' + ref_Id + ')" title="ارجاع نامه"><i class="glyphicon glyphicon-edit"></li></a>'
                }
            }
            , {
                "mData": "Letter_Id",
                "width": "1%",
                "render": function (Letter_Id, type, full, meta) {
                    return '<a href="#" onclick="ReferenceList(' + Letter_Id + ')" title="گردش نامه"><i class="glyphicon glyphicon-retweet"></li></a>'
                }
            }

        ]
     })
        .columns.adjust();

    if (clicked_id!=-16)
        table.columns([0, 1, 2, 3, 4]).visible(false); 
    else
        table.columns([0, 1, 2, 3, 4,12]).visible(false); 

}


var ViewLetter = function (refId) {        
        var url = "/Main/ViewLetter?Ref_Id=" + refId;
        $('body').css('cursor', 'wait');
        $("#myModalBodyDiv").load(url, function () {
            $("#myModal").modal("show");
        })       
}

var ReferenceLetter = function (refId) {          
    var url = "/Main/ReferenceLetter?Ref_Id=" + refId;
            $("#myModalBodyDivRefer").load(url, function () {
                $("#myModalRefer").modal("show");
        })                  
}


var ReferenceList = function (letterId) {       
    var url = "/Main/ReferenceList?Letter_Id=" + letterId;
    $("#myModalBodyDivReferList").load(url, function () {
        $("#myModalReferList").modal("show");
    })                  
}        

飞行识别码
参考号
字母识别码
旗帜
地位
كد
نوع
ارجاع دهنده
موضوع ارجاع
موضوع نامه
تاريخ دريافت
并在jquery中设置宽度,如下所示:

 <div class="col-md-9" style="background-color:gainsboro">

    <table cellpadding="0" cellspacing="0" border="0" class=" display stripe row-border  order-column"  id="example">
        <thead>
            <tr>
                <th>fld_Id</th>
                <th>ref_Id</th>
                <th>Letter_Id</th>
                <th>Flags</th>
                <th>Status</th>
                <th>كد</th>
                <th>نوع</th>
                <th>ارجاع دهنده</th>
                <th>موضوع ارجاع</th>
                <th>موضوع نامه</th>
                <th>تاريخ دريافت</th>
                <th></th>
                <th></th>
                <th></th>                    
            </tr>
        </thead>
        <tbody></tbody>           
    </table>

</div>
<script type="text/javascript">

var CategoryClick = function (clicked_id) {
    var boldMenu = $("#boldMenu").val();
    if  (boldMenu != clicked_id)
        $("#unBoldMenu").val(boldMenu);
    $("#boldMenu").val(clicked_id);
    var str = "#" + clicked_id;
    $("#ulTreeview").find(str).css('font-weight', 'bold');
    BindDataTable(clicked_id);
}

var BindDataTable = function (clicked_id) {  //response
    var boldMenu = $("#boldMenu").val();
     if (@User.Identity.Name=="" || @User.Identity.Name==null)
        window.location.href = '/ACCLogin/Login/';


    var table = $("#example").DataTable({
        "destroy": true,
        "bServerSide": true,
        "sAjaxSource": "/Main/GetLetterList",
        "fnServerData": function (sSource, aoData, fnCallback) {
            aoData.push({ "name": "fld_id", "value": boldMenu });
            $.ajax({
                type: "Get",
                data: aoData,
                url: sSource,
                dataType: "json",
                success: fnCallback,
                error: function (response) {
                        window.location.href = '/ACCLogin/Login/';
                }
            })

        },
        "fnDrawCallback": function () {
            var UnBoldMenu = "#" + $("#unBoldMenu").val();
            $("#ulTreeview").find(UnBoldMenu).css('font-weight', 'normal');
        },
        "fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
            if (aData["Flags"] == "4") {
                $('td', nRow).css('font-weight', 'bold');
            }
            if (aData["Status"] == "1") {
                $('td', nRow).css('background-color', 'lightgreen');

            }
        },            
        "aoColumns": [

            {
                "mData": "fld_Id",
                "width": "1%"},
            {
                "mData": "ref_Id",
                "width": "1%" },
            {
                "mData": "Letter_Id",
                "width": "1%" },
            {
                "mData": "Flags",
                "width": "1%" },
            {
                "mData": "Status",
                "width": "1%" },
            {
                "mData": "ProjectCode",
                "width": "1%" },
            {
                "mData": "LetterType",
                "width": "1%" },
            {
                "mData": "Referrer",
                "width": "29%" },
            {
                "mData": "Ref_subject",
                "width": "30%" },
            {
                "mData": "Letter_subject",
                "width": "30%" },
            {
                "mData": "Date_Received",
                "width": "1%"  },                
            {
                "mData": "ref_Id",
                "width": "1%",
                "render": function (ref_Id, aoData, type, full, meta) {
                    return '<a href="#" onclick="ViewLetter(' + ref_Id + ')" title="مشاهده نامه"><i class="glyphicon glyphicon-eye-open"></li></a>'
                }
            }, {
                "mData": "ref_Id",
                "width": "1%",
                "render": function (ref_Id, type, full, meta) {
                    return '<a href="#" onclick="ReferenceLetter(' + ref_Id + ')" title="ارجاع نامه"><i class="glyphicon glyphicon-edit"></li></a>'
                }
            }
            , {
                "mData": "Letter_Id",
                "width": "1%",
                "render": function (Letter_Id, type, full, meta) {
                    return '<a href="#" onclick="ReferenceList(' + Letter_Id + ')" title="گردش نامه"><i class="glyphicon glyphicon-retweet"></li></a>'
                }
            }

        ]
     })
        .columns.adjust();

    if (clicked_id!=-16)
        table.columns([0, 1, 2, 3, 4]).visible(false); 
    else
        table.columns([0, 1, 2, 3, 4,12]).visible(false); 

}


var ViewLetter = function (refId) {        
        var url = "/Main/ViewLetter?Ref_Id=" + refId;
        $('body').css('cursor', 'wait');
        $("#myModalBodyDiv").load(url, function () {
            $("#myModal").modal("show");
        })       
}

var ReferenceLetter = function (refId) {          
    var url = "/Main/ReferenceLetter?Ref_Id=" + refId;
            $("#myModalBodyDivRefer").load(url, function () {
                $("#myModalRefer").modal("show");
        })                  
}


var ReferenceList = function (letterId) {       
    var url = "/Main/ReferenceList?Letter_Id=" + letterId;
    $("#myModalBodyDivReferList").load(url, function () {
        $("#myModalReferList").modal("show");
    })                  
}        

var CategoryClick=函数(单击\u id){
var boldMenu=$(“#boldMenu”).val();
如果(粗体菜单!=单击的\u id)
$(“#取消绑定菜单”).val(粗体菜单);
$(“粗体菜单”).val(单击的id);
var str=“#”+单击的_id;
$(“#ulTreeview”).find(str).css('font-weight','bold');
BindDataTable(单击\u id);
}
var BindDataTable=函数(单击的\u id){//响应
var boldMenu=$(“#boldMenu”).val();
if(@User.Identity.Name==“”| |@User.Identity.Name==null)
window.location.href='/ACCLogin/Login/';
var table=$(“#示例”).DataTable({
“毁灭”:真的,
“bServerSide”:正确,
“sAjaxSource”:“/Main/GetLetterList”,
“fnServerData”:函数(sSource、aoData、fnServerData回调){
推送({“name”:“fld_id”,“value”:boldMenu});
$.ajax({
键入:“获取”,
数据:aoData,
网址:sSource,
数据类型