title: asp.net Button event inside jQuery FaceBox
body: <p>I'm using jQuery FaceBox to show a textbox, a dropdownlist and a button. The user can write a text in the textbox, select a value in the ddl abd hit the button. This fires some code in the codebehind. The FaceBox shows fine, and the content in it is also ok. Also, the button event is fired. This is the code for the button event handler:</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
      {
          _favorit = new Favoritter();
          ListItem fav = ddl_favoritter.SelectedItem;
          _favorit.FavoritterFolderID = int.Parse(fav.Value);
          //_favorit.FavoritterFolderID = Convert.ToInt32(ddl_favoritter.SelectedItem);
          _favorit.FavoritterNavn = txt_favoritNavn.Text;
          _favorit.FavoritterUserID = UserID;
          _favorit.FavoritterUrl = HttpContext.Current.Request.Url.ToString();
          FavoritterManager.InsertFavoritter(_favorit);
      }
  </code></pre>
  
  <p>A business object is created, and its properties set with the values read from the controls. The object is then inserted into a database, which works just fine. The problem is that the textbox and dropdown values are not set properly. The textbox value is empty, and the ddl selected value is allways 1, even though I write in the textbox, and select another ddlitem before I hit the button. The ddl is loaded like this:</p>
  
  <pre><code>if (!Page.IsPostBack)
              {
                  _favoritter = FavoritterFolderManager.GetFavoritterFolderByUser(UserID);
                  ddl_favoritter.DataSource = _favoritter;
                  ddl_favoritter.DataBind();
  
              }
  </code></pre>
  
  <p>I tried putting this code outside if (!Page.IsPostBack), and also filling it using an objectdatasource, still the same issue. It's like the controls are "reset" as I hit the button, and I don't think it has anything to do with the FaceBox, as all it does is to show the div that contains the controls... Then again, it might... Any ideas?</p>
  
  <p>This is the code in the aspx page:</p>
  
  <pre><code>&lt;div id="showme" style="display:none;"&gt;
                          Add to favourites.&lt;br /&gt;
                          &lt;br /&gt;
                          &lt;p&gt;
                              Title:&amp;nbsp;&lt;span&gt;&lt;asp:TextBox ID="txt_favoritNavn" runat="server"&gt;&lt;/asp:TextBox&gt;&lt;/span&gt;&lt;/p&gt;
                          &lt;p&gt;
                              select folder:&amp;nbsp;&lt;span&gt;&lt;asp:DropDownList ID="ddl_favoritter" runat="server" DataTextField="FavoritterFolderNavn"
                                  DataValueField="FavoritterFolderID" AppendDataBoundItems="true"&gt;
                              &lt;/asp:DropDownList&gt;
                              &lt;/span&gt;
                          &lt;/p&gt;
                          &lt;br /&gt;
                          &lt;asp:Button ID="Button1" runat="server" Text="Gem" onclick="Button1_Click"/&gt;
                      &lt;/div&gt;
  </code></pre>