首页 新闻 赞助 找找看

asp.net 后台获取checkbox值

0
[已解决问题] 解决于 2013-12-28 19:27

    function addTableMedia(id) {         //获取最后一个元素的模板         var new_table = document.getElementById(id).lastChild.cloneNode(true);         //         for (var i = 0; i < new_table.all.length; i++) {

 

            if (new_table.all(i).type == "checkbox") {

                new_table.name = "chkRush";             }

 

            if (                   new_table.all(i).id == document.getElementById("<%=txtCsrName.ClientID  %>").id ||                  new_table.all(i).id == document.getElementById("<%=txtCsrNo.ClientID  %>").id             ) {                                                 continue;             }             else if( new_table.all(i).id == document.getElementById("<%=txtIntime.ClientID  %>").id  )             {

                var myDate = new Date();                  new_table.all(i).value = (myDate.getFullYear()) + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate() + " " + myDate.toLocaleTimeString();                         }             else {                 new_table.all(i).value = "";             }                     }

        new_table.id   = "Media_table";                   document.getElementById(id).appendChild(new_table);        

                  

        //    new_table.focus();     }

 

克隆出的checkbox后台怎么获取

js灰灰的主页 js灰灰 | 初学一级 | 园豆:7
提问于:2013-12-05 14:46
< >
分享
最佳答案
0

js 复制的只是asp.net的服务器控件解析成html之后的html代码,实际上服务器控件还会在后台注册很多事件,所以复制之后的checkbox直接在后台是取不到的,可以用提交表单的方式直接提交到后台然后取值,也可以用异步传值

奖励园豆:5
Zery | 大侠五级 |园豆:6151 | 2013-12-05 14:57
其他回答(2)
0

只要有name就可以在后台通过Request.Form获取

_A_A | 园豆:1139 (小虾三级) | 2013-12-05 15:28
0

给checkbox 加个name和value属性 name=“ch” value=“1(这个1可以是任意值)”  然后你可以在后台判断它的value是否为null 来判定是否选中。

wolfy | 园豆:2636 (老鸟四级) | 2013-12-06 13:30
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册