我的一个gridview控件每一列都是TemplateField,某一列TemplateField用的是checkboxlist.其他列用的是TextBox,除此之外,页面还用到了模板页,所以,生成的页面里边有下面的代码
<table id="ctl00_ContentPlaceHolder1_GridView1_ctl02_choicesCheckBox" border="0"> <tr> <td> <input id="ctl00_ContentPlaceHolder1_GridView1_ctl02_choicesCheckBox_0" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl02$choicesCheckBox$0" /> <label for="ctl00_ContentPlaceHolder1_GridView1_ctl02_choicesCheckBox_0">取消 </label> </td> <td> <input id="ctl00_ContentPlaceHolder1_GridView1_ctl02_choicesCheckBox_1" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl02$choicesCheckBox$1" /> <label for="ctl00_ContentPlaceHolder1_GridView1_ctl02_choicesCheckBox_1">减少 </label> </td>
</tr>
</table>
</td> <td>
<span id="ctl00_ContentPlaceHolder1_GridView1_ctl02_IDLabel" style="display:inline-block;width:30px;position: relative">931149 </span>
</td> <td>
<input name="ctl00$ContentPlaceHolder1$GridView1$ctl02$S_TextBox" type="text" value="0" id="ctl00_ContentPlaceHolder1_GridView1_ctl02_S_TextBox" style="width:30px;position: relative" />
</td>
我想知道如何使用javascript,但不通过getelementbyid,getelementbyname的方式,区分用户是选择了"取消",还是"减少",请注意gridview生成的表格中行数是不固定的,除此之外,还有其他的部分也会生成<input>标签供用户输入数据。
<table id="ctl00_ContentPlaceHolder1_GridView1_ctl02_choicesCheckBox" border="0"> <tr> <td> <input id="ctl00_ContentPlaceHolder1_GridView1_ctl02_choicesCheckBox_0" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl02$choicesCheckBox$0" /> <label for="ctl00_ContentPlaceHolder1_GridView1_ctl02_choicesCheckBox_0">取消 </label> </td> <td> <input id="ctl00_ContentPlaceHolder1_GridView1_ctl02_choicesCheckBox_1" type="checkbox" name="ctl00$ContentPlaceHolder1$GridView1$ctl02$choicesCheckBox$1" /> <label for="ctl00_ContentPlaceHolder1_GridView1_ctl02_choicesCheckBox_1">减少 </label> </td>
</tr>
</table>
</td> <td>
<span id="ctl00_ContentPlaceHolder1_GridView1_ctl02_IDLabel" style="display:inline-block;width:30px;position: relative">931149 </span>
</td> <td>
<input name="ctl00$ContentPlaceHolder1$GridView1$ctl02$S_TextBox" type="text" value="0" id="ctl00_ContentPlaceHolder1_GridView1_ctl02_S_TextBox" style="width:30px;position: relative" />
</td>
我想知道如何使用javascript,但不通过getelementbyid,getelementbyname的方式,区分用户是选择了"取消",还是"减少",请注意gridview生成的表格中行数是不固定的,除此之外,还有其他的部分也会生成<input>标签供用户输入数据。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货