How to update a dropdownlist inside an Ajax modal popup panel
<p>I have a girdview in side an update panel, the girdview allows to edit, delete the data in my database, I have button named Insert, when the insert button is clicked, an ajax model popup panel will show up, inside that pop up panel, there is a dropdownlist.</p>

<p>My question is that how can I update the dropdownlist inside the popup panel every time there is a change in my girdview panel. </p>

<p>I tried changing some data in the girdview, then I have to refresh the whole paper(thing which I don't want to do) to update the dropdownlist.</p>

<pre><code>&lt;%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master"  AutoEventWireup="true" 
 CodeBehind="Test.aspx.cs" Inherits="Pages" %&gt;
&lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"   TagPrefix="ajaxToolkit" %&gt;

  &lt;asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"&gt;
</code></pre>

<p></p>

<pre><code>    &lt;asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"&gt;
 &lt;asp:Button ID="RegisterButton" runat="server" Text="Register" OnClick="callmethod" /&gt;
 &lt;asp:ScriptManager ID="ScriptManager" runat="server"&gt;
 &lt;/asp:ScriptManager&gt;
 &lt;asp:Panel ID="MainPanel" runat="server" Style="display: none" CssClass="modalPopup"&gt;
      &lt;div&gt;
           &lt;asp:Table ID="InputTable" runat="server"&gt;
                &lt;asp:TableRow&gt;
                     &lt;asp:TableCell&gt;
                          &lt;asp:Label ID="LabelName" runat="server" Text="name"&gt;     &lt;/asp:Label&gt;
                     &lt;/asp:TableCell&gt;
                     &lt;asp:TableCell&gt;
                          &lt;asp:TextBox ID="TName" runat="server"&gt;&lt;/asp:TextBox&gt;
                     &lt;/asp:TableCell&gt;
                     &lt;asp:TableCell&gt;
                          &lt;asp:RequiredFieldValidator ID="NameRequiredFieldValidator" ControlToValidate="TName"
                               runat="server" ErrorMessage="RequiredFieldValidator"&gt;Cannot be Empty&lt;/asp:RequiredFieldValidator&gt;
                     &lt;/asp:TableCell&gt;
                     &lt;asp:TableCell&gt;&lt;asp:DropDownList ID="TProjectMID" runat="server"&gt;  &lt;/asp:DropDownList&gt;&lt;/asp:TableCell&gt;
                &lt;/asp:TableRow&gt;
           &lt;/asp:Table&gt;
           &lt;p style="text-align: center;"&gt;
                &lt;asp:Button ID="OkButton" runat="server" Text="OK" UseSubmitBehavior="false" OnClick="OkButton_Click" /&gt;
                &lt;asp:Button ID="CancelButton" runat="server" Text="Cancel" /&gt;
           &lt;/p&gt;
      &lt;/div&gt;
   &lt;/asp:Panel&gt;
      &lt;ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="RegisterButton"
      BackgroundCssClass="modalBackground" PopupControlID="MainPanel" OkControlID="OkButton"
      OnOkScript="onOk()" CancelControlID="CancelButton" PopupDragHandleControlID="InfoPanel" /&gt;
   &lt;asp:UpdatePanel ID="UpdatePane" runat="server"&gt;
        &lt;ContentTemplate&gt;
           &lt;asp:GridView ID="GridView" runat="server" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" DataKeyNames="ProjectID" DataSourceID="DataSource"
                Width="921px"&gt;
                &lt;Columns&gt;
                     &lt;asp:CommandField ShowDeleteButton="True" CausesValidation="false"  causeValidation = "false"/&gt;
                     &lt;asp:BoundField DataField="ID" HeaderText="ProjectID" SortExpression="ProjectID"
                          ReadOnly="True" /&gt;
                     &lt;asp:BoundField DataField="Name" HeaderText="ProjectName" SortExpression="ProjectName" /&gt;
                &lt;/Columns&gt;
           &lt;/asp:GridView&gt;
           &lt;asp:SqlDataSource ID="DataSource" runat="server" ConnectionString="&lt;%$ ConnectionStrings:ConnectionString %&gt;"
                DeleteCommand="DeleteProject" DeleteCommandType="StoredProcedure"&gt;
                &lt;DeleteParameters&gt;
                     &lt;asp:Parameter Name="original_ID" Type="String" /&gt;
                     &lt;asp:Parameter Name="original_Name" Type="String" /&gt;
                &lt;/DeleteParameters&gt;
           &lt;/asp:SqlDataSource&gt;
      &lt;/ContentTemplate&gt;
 &lt;/asp:UpdatePanel&gt;
</code></pre>

<p></p>
