C# ASP.NET browser resize event

3k Views Asked by At

I cannot find a resize event for my C# Asp.Net application. I'm trying to do something like this, but there is no onresize event in my <body runat="server" ..>.

How do I add a function call on the event of browser resize in my C# ASP.NET application?

2

There are 2 best solutions below

0
Seano666 On BEST ANSWER

You need to add your custom resize handler to the window using JavaScript. Something like this.

<script>
function customResize(){
  //your code
}

function onLoad(){
  window.onresize = customResize;
}
</script>
<body onload="onLoad"></body>
0
Moni On

You can look into the below article, which has a jQuery example: https://www.geeksforgeeks.org/cross-browser-window-resize-event-using-javascript-jquery/

Sorry looks like very old thread. I just wanted to have it here, in case someone is still looking for an answer.