码迷,mamicode.com
首页 > 其他好文 > 详细

GridView全局仅能选择一个复选框

时间:2014-06-26 00:31:41      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:style   tar   ext   color   get   width   

//全局仅能选择一个复选框

function CheckLimit(check) {
            var inputs = document.getElementsByTagName("input");
            for (var i = 0; i < inputs.length; i++) {
                if (inputs[i].type == "checkbox") {
                    inputs[i].checked = false;
                }
            }
            check.checked = true;
        }

控件

 <asp:GridView ID="gvwInfo" runat="server" Width="654px"
                                                                    EmptyDataText="无信息!">
                                                                    <EmptyDataRowStyle ForeColor="Red" HorizontalAlign="Center" />
                                                                    <Columns>
                                                                        <asp:TemplateField>
                                                                            <ItemTemplate>
                                                                                <asp:CheckBox ID="SelectData" runat="server" onclick="ColumnCheckLimit(this)"/>//调用JS方法
                                                                            </ItemTemplate>
                                                                            <ItemStyle HorizontalAlign="Center" />
                                                                            <HeaderStyle Width="8%" HorizontalAlign="Center" />
                                                                        </asp:TemplateField>
                                                                        <asp:BoundField HeaderText="名称" DataField="NAME">
                                                                            <ItemStyle Width="40%" HorizontalAlign="Center" />
                                                                            <HeaderStyle Width="40%" HorizontalAlign="Center" />
                                                                        </asp:BoundField>
                                                                </Columns>
                                                                </asp:GridView>

GridView全局仅能选择一个复选框,布布扣,bubuko.com

GridView全局仅能选择一个复选框

标签:style   tar   ext   color   get   width   

原文地址:http://www.cnblogs.com/hjxh/p/3804325.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!