0

I have a ASP page which has a gridview. I have set the gridview height and width in javascript by using window.height and window.width. But when user resizes the browser the gridview size is not updated as it occurs only during page load. So how can I make gridview to set to page size when user resizes the browser window . I used below code As mentioned in link . But it reloads the page again and Page_load from code behind is run again and again data are retrieved from database etc. So is there any other methods without loading the page(Form_load) again?

jQuery(function($){
var windowWidth = $(window).width();

$(window).resize(function() {
 if(windowWidth != $(window).width()){
 location.reload();
 return;
 }
});
});
Community
  • 1
  • 1
IT researcher
  • 3,274
  • 17
  • 79
  • 143
  • Why not just use width=100% for the Gridview? That will automatically use the full width of the window. You can't control the height of the Gridview as that depends on the number of rows. – navigator Sep 02 '14 at 09:52
  • @navigator It's already set. But i am tring gridview with freezed header . I am using code shown in (Cell wrap logic) the link http://gridviewscroll.aspcity.idv.tw/Demo.aspx . In that code in script i set height and width variable using window.height and window.width .I cant avoid it because I have to use that method for freezing header. – IT researcher Sep 02 '14 at 10:06

0 Answers0