title: Set dynamically height of ajax Modal Popup
body: <p>I am creating an asp.net c# web application.In which i have a ajax modal PopUp,which contains a GridView.
  Height of ModalPopUp is set automatically according to the height of the GridView(which depends on the Data comes inside GridView).
  Now what i want is that ,when the height of Popup  becomes larger then its parent  page,at that time i want to reset
  the height of PopUp(less then parent page ) and set a scroll bar on it.
  All this i want to do dynamically client side.
  For this i am using following code </p>
  
  <pre><code>    function ShowPopUp_AllPrices() {          
      $find('popupAllPrices').show();       
      return false;   
      }
  
  
  
  &lt;asp:LinkButton ID="lnkProduct" runat="server"&gt;&lt;/asp:LinkButton&gt;
  &lt;ajaxToolkit:ModalPopupExtender ID="ModalPopupProduct" runat="server" BehaviorID="popupProduct"
      TargetControlID="lnkProduct" PopupControlID="pnlAddProduct"    BackgroundCssClass="modalBackground" /&gt;
  &lt;asp:Panel ID="pnlAddProduct" runat="server" Style="display: none; width: 80%; font-size: 8pt;"&gt;
  
   &lt;div&gt;
          &lt;asp:LinkButton ID="lnkAllPrices" runat="server"&gt;&lt;/asp:LinkButton&gt;
          &lt;ajaxToolkit:ModalPopupExtender ID="ModalPopupAllPrices" runat="server" BehaviorID="popupAllPrices"
              TargetControlID="lnkAllPrices" PopupControlID="pnlAllPrices" BackgroundCssClass="modalBackground"  /&gt;
          &lt;asp:Panel ID="pnlAllPrices" runat="server" Style="display: none; width: 30%; font-size: 8pt; "&gt;
        &lt;div class="art-blockcontent"&gt;
                          &lt;div class="art-BlockContent-body"&gt;
                              &lt;%--&lt;div style="overflow: auto; width: 100%; height: 200px;"&gt;--%&gt;
                              &lt;table width="100%"&gt;
                                  &lt;tr&gt;
                                      &lt;td align="center"&gt;
                                          &lt;div style="overflow: auto; width: 100%; "&gt;&lt;%--height: 200px;--%&gt;
                                              &lt;asp:GridView ID="grvPriceTypes2" runat="server" AutoGenerateColumns="False"      AllowSorting="true"
                                                  EmptyDataText="No Data Found." Width="90%" CssClass="cssGrid" BackColor="WhiteSmoke"
                                                  PagerStyle-HorizontalAlign="Center" OnRowCommand="grvPriceTypes2_OnRowCommand"
                                                  Enabled="false"&gt;
                                                  &lt;Columns&gt;
                                                      &lt;asp:BoundField DataField="StartDate" HeaderText="Start Date"      DataFormatString="{0:MM/dd/yyyy}"
                                                          ItemStyle-HorizontalAlign="Center" ItemStyle-Width="25%" /&gt;
                                                      &lt;asp:BoundField DataField="EndDate" HeaderText="End Date"     DataFormatString="{0:MM/dd/yyyy}"
                                                          ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20%" /&gt;
                                                      &lt;asp:BoundField DataField="PriceType" HeaderText="Type"      ItemStyle-HorizontalAlign="Center"
                                                          ItemStyle-Width="15%" /&gt;
                                                      &lt;asp:BoundField DataField="Price" HeaderText="Price"      ItemStyle-HorizontalAlign="right"
                                                          ItemStyle-Width="20%" /&gt;
                                                  &lt;/Columns&gt;
                                              &lt;/asp:GridView&gt;
                                          &lt;/div&gt;
                                      &lt;/td&gt;
                                  &lt;/tr&gt;
                              &lt;/table&gt;                                                            
                          &lt;/div&gt;
                      &lt;/div&gt;
    &lt;/asp:Panel&gt;
      &lt;/div&gt;
   &lt;/asp:Panel&gt;
  </code></pre>
  
  <p>Please tel me what code i should write in  ShowPopUp_AllPrices() function to set height and scroll bar for that Modal Popup.</p>