Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/311.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# 如何访问嵌套的html表数据?_C#_Javascript_Asp.net - Fatal编程技术网

C# 如何访问嵌套的html表数据?

C# 如何访问嵌套的html表数据?,c#,javascript,asp.net,C#,Javascript,Asp.net,我有这样的桌子: <table id="Maintb"> <tbody> <tr> <td> <table> <tr>..</tr> <tr>..</tr> <tr>..</tr> </table> <table> <tr>..</tr>

我有这样的桌子:

<table id="Maintb">
<tbody>
<tr> 
<td>  <table>   <tr>..</tr>
                 <tr>..</tr>
                 <tr>..</tr>
</table>
<table>     <tr>..</tr>
            <tr>..</tr>
             <tr>..</tr>
</table>
<table>       <tr>..</tr>
            <tr>..</tr>
             <tr>..</tr>
   </table>
</td> 
</tr>

..
..
..
..
..
..
..
..
..


表1、2、3包含不同数量的复选框。如果用户选中了这三个表中的一些复选框。如何获取检查值。这些表是动态创建的。嵌套表没有id。这在JavaScript或c#中是如何实现的。如果有人打我

我不确定,但正如您所说,您希望存储用户选中的复选框值,您可以尝试一下:

var checkedValues = $("#Maintb table input:checkbox:checked").map(function(){
    return this.value;
}).get().join(",");
文档


希望这对你有帮助

这里有一个JsFiddle来记录checked/unchecked

$('.testme')。单击(函数(){
如果(选中此项){
console.log($(this.attr('data-val')+'checked');
}否则{
log($(this.attr('data-val')+'unchecked');
}
});

希望这对您有所帮助

您可以使用任何语言。但目的是什么?到目前为止,您已经有了什么?jQuery$(“#Maintb table”)jQuery$(“#Maintb table 3 tr”)我想存储用户选中的复选框值。如果要将(var checkedvalues)放入c数组中,我该怎么做。谢谢你抽出时间。