Add row to gridview on client side

痴心易碎 提交于 2019-12-25 04:36:15

问题


I have asp.net's .aspx page. that have GridView let say GridViewParent and Each row have the another GridView as GridViewChild. Now GridViewChild have button AddRow and another controls like DropDownControl,RadioButtons..etc... I want after click the button AddRow there must add row on client side. How can i do same. Please guide me .... Send me code


回答1:


<script type="text/javascript" src="../../js/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
    $('#<%=cmdAdd.ClientID %>').bind('click', function(event) {
        //debugger;
        event.preventDefault();
        var $grid = $('#<%=ctlGrid.ClientID %> ');
        var $row = $grid.find('tr:last').clone().appendTo($grid);
        $row.find('select')[0].selectedIndex = 0;
        $row.find('input').each(function() {
            $(this).val("");
        });
        return true;
    });
});



来源:https://stackoverflow.com/questions/2108573/add-row-to-gridview-on-client-side

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!