Reputation: 1113
I have problem on setting the height of asp panel using javascript. I used below code to do this but didn't work.
<script type="text/javascript">
$(function() {
var sheight = $(window).height();
$("#paneldata").height(sheight-240);
});
</script>
What must be the problem with my code?
Thanks in advance.
Upvotes: 1
Views: 2034
Reputation: 18883
I think the problem is that asp.net has server side controls then get target id this way(and fix other issue also as shown below) :
<script type="text/javascript">
$(function() {
var sheight = $(window).height();
$("#<%=paneldata.ClientID %>").height((sheight-240) + "px");
});
</script>
OR(If you are using ClientID in Static Mode) then try this only :
<script type="text/javascript">
$(function() {
var sheight = $(window).height();
$("#paneldata").height((sheight-240) + "px"); // add 'px' with height as shown here
});
</script>
Upvotes: 2