title: Assign a Textbox Value to the modal-box on the same page
body: <p>How to get the textbox value on code-behind after the textbox value assigned on a modal-box?</p>
  
  <p>This is how the modal-box appear on the page:</p>
  
  <pre><code>&lt;div id="dialog-form" title="Modal Box"&gt;
      &lt;asp:TextBox ID="Textbox1" runat="server" ReadOnly="True"&gt;   
      &lt;asp:Button ID="Save_Button" runat="server" Text="Save"&gt;&lt;/asp:Button&gt;        
  &lt;/div&gt;
  </code></pre>
  
  <p>In order to assign the value on <code>Textbox1</code>, I attach a Javascript function to the LinkButton on a Gridview (the code not showed here) through code-behind based on the LinkButton clicked:</p>
  
  <pre><code>Dim myLinkButton As LinkButton    
  For i As Integer = 0 To GV1.Rows.Count - 1
    myLinkButton = DirectCast(GV1.Rows(i).Cells(1).FindControl("LinkButton"), LinkButton)
    myLinkButton.Attributes.Add("onclick", "shopModalPopup('" + .Rows(i).Cells(0).Text &amp; "'); return false;")
  Next
  </code></pre>
  
  <p><code>Rows(i).Cells(0)</code> is the first column on the Gridview, it is "<code>ID</code>". This <code>ID</code> will be assigned to the <code>Textbox1</code> while the Linkbutton clicked.</p>
  
  <p>The Javascript code is on the same page as the Gridview code:</p>
  
  <pre><code>&lt;script&gt;
  var grid_modal_options = {
                      height: 450,
                      width: 550,
                      modal: true
                  };
  
  function shopModalPopup(id) {
                      var DataField = id;
                      grid_modal_options.open = function () {
                          $('#dialog-form #Textbox1').val(DataField);
                      };
  
                      $("#dialog-form").dialog(grid_modal_options);
                      $("#dialog-form").parent().appendTo('form:first');
                  }
  &lt;/script&gt;
  </code></pre>
  
  <p>When I clicked the Save Button on the modal-box, the value on the <code>Textbox1</code> can't catch on the code-behind. It always return null value. How to do that? Thank you very much.</p>