title: asp.net DataList inside Datalist problems with C# interpretation
body: <p>I need to use <code>DataList</code> inside another <code>DataList</code>. It works fine for me, but when I'm trying to do something in code behind with this inside one it just doesn't exist for C#. Here is code:</p>
  
  <pre><code>...
  
  &lt;asp:DataList ID="DataListDziennik" runat="server"
      DataSourceID="SqlDataSourcePrzedmioty"&gt;
      &lt;ItemTemplate&gt;
          &lt;asp:Label ID="LabelPrzedmiot" runat="server" Text='&lt;%# Eval("przedmiot") %&gt;' /&gt;
  
          ...
  
              &lt;asp:DataList ID="DataListOceny" runat="server" 
                  DataSourceID="SqlDataSourceOceny" 
                  RepeatDirection="Horizontal" 
                  OnItemCommand="DataListOceny_ItemCommandOceny"
                  OnEditCommand="DataListOceny_EditCommandOceny"&gt;
  
                  &lt;EditItemTemplate&gt;
  
                      &lt;asp:TextBox ID="TextBoxOcena" runat="server" Text='&lt;%# Bind("lista") %&gt;' /&gt;
                      &lt;td&gt;&lt;asp:Button ID="ButtonZapisz" CommandName="Update" runat="server" Text="Zapisz" /&gt;&lt;/td&gt;
  
                  &lt;/EditItemTemplate&gt;
  
                  &lt;ItemTemplate&gt;
  
                      &lt;asp:TextBox Width="20" ID="TextBoxOcena" ReadOnly="true" Text='&lt;%# Eval("lista") %&gt;' runat="server"&gt;&lt;/asp:TextBox&gt;
                      &lt;td&gt;&lt;asp:Button ID="ButtonEdytuj" CommandName="Edit" runat="server" Text="Edytuj" /&gt;&lt;/td&gt;
  
                  &lt;/ItemTemplate&gt;
              &lt;/asp:DataList&gt;
          &lt;/td&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:DataList&gt;
  </code></pre>
  
  <p>When I write this in code behind:</p>
  
  <pre><code>        protected void DataListOceny_EditCommand(object source, DataListCommandEventArgs e)
      {
          DataListOceny.EditItemIndex = e.Item.ItemIndex;
  
          DataListOceny.DataBind();
      }
  </code></pre>
  
  <p>...Visual Studio tells me that <code>DataListOceny does not exist in current content</code>. I just want to be able edit items on <code>DataListOceny</code> after clicking the "edit" button, it can be placed anywhere on website. Do you know any solution for this problem?</p>