Friday, May 20, 2011

Resize grid on Browser resize


//ctl00_ContentPlaceHolder1_RadGrid_List_GridData .(this is grid ID).
//ctl00_ContentPlaceHolder1_grdview_GridData (second grid id)

<script>
    jQuery(document).ready(function(){
                jQuery(window).resize(function(){
                    var orignalHeight = parseInt($(window).height());
                    var newHeight = (orignalHeight/25)*8;
                    var containterHeight = parseInt($("#ctl00_ContentPlaceHolder1_RadGrid_List_GridData").height());

                    $('#ctl00_ContentPlaceHolder1_RadGrid_List_GridData').css('cssText', 'height: '+newHeight+'px !important');
                    $("#ctl00_ContentPlaceHolder1_RadGrid_List_GridData").css({'overflow':'auto','width':'100%'});
                    //alert($("#ctl00_ContentPlaceHolder1_RadGrid_List_GridData").height());
                  
                    var secContainerHeight=parseInt($("#ctl00_ContentPlaceHolder1_grdview_GridData").height());
                    $('#ctl00_ContentPlaceHolder1_grdview_GridData').css('cssText','height:'+newHeight+'px !important');
                    $("#ctl00_ContentPlaceHolder1_grdview_GridData").css({'overflow':'auto','width':'100%'});
                  
                  
                });
            });
    </script>

No comments:

Post a Comment