title: ListView not firing OnItemCommand (nor ItemInserting) after preventing postback
body: <p>I have a ListView inside a FormView that, for some strange reason, doesn't fire neither the ItemInsert nor the ItemCommand event.
  I'm populating the ListView with a generic list. I bind the list to the ListView on the OnPreRenderComplete.</p>
  
  <pre><code>    &lt;asp:ListView runat="server" ID="lvReferences" DataKeyNames="idReference" OnItemInserting="ContractReferences_Inserting" OnItemDeleting="ContractReferences_Deleting" InsertItemPosition="LastItem" OnItemCommand="ContractReferences_Command" OnItemCreated="ContractReferences_ItemDataBound"&gt;                                    
      &lt;LayoutTemplate&gt;
          &lt;ul&gt;       
                  &lt;asp:PlaceHolder ID="itemPlaceholder" runat="server" /&gt;
          &lt;/ul&gt;                                   
      &lt;/LayoutTemplate&gt;
      &lt;ItemTemplate&gt;
          &lt;li class="obsItem"&gt;
              &lt;a href="#"&gt;&lt;asp:TextBox ID="valRef" runat="server" Width="5px" Enabled="false" Text='&lt;%#Bind("idProcessRecordRef") %&gt;' /&gt;&lt;/a&gt;                                    
              &lt;asp:TextBox id="txtRef" runat="server" Text='&lt;%#Bind("description") %&gt;' /&gt;
              &lt;asp:ImageButton ID="btDelete" runat="server" CommandName="Delete" ImageUrl="~/_layouts/web.commons/Images/eliminar.png" /&gt;
          &lt;/li&gt;
      &lt;/ItemTemplate&gt; 
      &lt;InsertItemTemplate&gt;
          &lt;li class="obsItem"&gt;
              &lt;a href="#"&gt;&lt;asp:TextBox ID="valRef" runat="server" Width="5px" Enabled="false" /&gt;&lt;/a&gt;                                    
              &lt;asp:TextBox id="txtRef" runat="server" /&gt;
              &lt;asp:ImageButton ID="btDetail" CausesValidation="false" OnClientClick="javascript:openPopup();return false;" runat="server" ImageUrl="~/_layouts/web.commons/Images/novo.png" /&gt;
              &lt;asp:ImageButton ID="btSaveDs" runat="server" CommmandName="Insert" CausesValidation="false" ImageUrl="~/_layouts/web.commons/Images/gravarObs.png" /&gt;
          &lt;/li&gt;
      &lt;/InsertItemTemplate&gt;
  &lt;/asp:ListView&gt;   
  </code></pre>
  
  <p>My ItemDataBound method is:</p>
  
  <pre><code>    protected void ContractReferences_ItemDataBound(object sender, ListViewItemEventArgs e)
      {
          if (!IsPostBack)
          {
              TextBox valRef = e.Item.FindControl("valRef") as TextBox;
              TextBox txtRef = e.Item.FindControl("txtRef") as TextBox;
              ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", "function openPopup(){ window.open('ContractPicker.aspx?c1=" + valRef.ClientID + "&amp;c2=" + txtRef.ClientID + "');}", true);
          }
      }
  </code></pre>
  
  <p>So, basically, in the InsertItemTemplate I put a button that opens a LOV and populates my valRef and txtRef fields. I had to put a "return false" in order for the parent page to not postback (and I think the problem lies here...).
  Then, when I click in the ImageButton with the CommandName="Insert", instead of firing the ItemCommand event, it enters once again in the ItemDataBound handler.</p>
  
  <p>So, any ideas?</p>
  
  <p>Thanks!</p>