asp.net get window width/height in server side



Step 1:


put a hidden field on asp.net page 

<asp:HiddenField ID="width" runat="server" />
<asp:HiddenField ID="height" runat="server" />


Step 2: use jquery set value


<script type="text/javascript">


$(document).ready(function() {


    $("#width").val() = $(window).width();
    $("#height").val() = $(window).height();    


});


</script>


Step 3: use in asp.net code behind

你可能感兴趣的:(asp.net get window width/height in server side)