通过js给gridview内的textbox赋值
1 <script type="text/javascript"> 2 function Check() 3 { 4 var tb=document.getElementById("<% = GridView1.ClientID %>"); 5 for (i=1;i<tb.rows.length;i++) 6 { 7 var cb = tb.rows[i].getElementsByTagName("input")[1]; 8 var textbox = tb.rows[i].getElementsByTagName("input")[0]; 9 if(cb.checked) 10 { 11 textbox.value="aaa"; 12 textbox.readOnly = false; 13 textbox.style.backgroundColor="white"; 14 } 15 else 16 { 17 textbox.readOnly = true; 18 textbox.style.backgroundColor="Gainsboro"; 19 } 20 } 21 } 22 </script>
点击checkbox后textbox内容改变