Hi Mirek,
Welcome to the MSDN newsgroup.
As for the DataList databinding problem you mentioned, are you using
ASP.NET 2.0 and bind those DataList contro with some DataSource controls?
For ASP.NET 1.1, we need to reattache the DataSource when we redo the
databinding on DataList. For ASP.NET 2.0, I've just performed some simple
tests on myside and the edit command can work correct for both the parent
and nested sub DataList, therefore I think there may exists something else
incorrect which cause the problem behavior. Have you checked the template
to see whether all the button(for edit ) is assigned the "CommandName" as
Edit. Here is a test page's aspx template and the related event handler
in
code behind, you can have a look for reference if can help:
===========aspx============
<div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Data Source=localhost;Initial
Catalog=Northwind;Integrated Security=True"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT
[CategoryID], [CategoryName], [Description] FROM [Categories]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="Data Source=localhost;Initial
Catalog=Northwind;Integrated Security=True"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT TOP
3 [ProductID], [CategoryID], [ProductName] FROM [Products]">
</asp:SqlDataSource>
<asp

ataList ID="DataList1" runat="server"
DataSourceID="SqlDataSource1" OnItemCommand="DataList1_ItemCommand">
<ItemTemplate>
CategoryID:
<asp:Label ID="CategoryIDLabel" runat="server" Text='<%#
Eval("CategoryID") %>'></asp:Label><br />
CategoryName:
<asp:Label ID="CategoryNameLabel" runat="server" Text='<%#
Eval("CategoryName") %>'></asp:Label><br />
Description:
<asp:Label ID="DescriptionLabel" runat="server" Text='<%#
Eval("Description") %>'></asp:Label><br />
<asp:Button ID="btnEdit" runat="server" CommandName="Edit"
Text="Edit" /><br />
</ItemTemplate>
<EditItemTemplate>
<asp

ataList ID="DataList2" runat="server"
DataSourceID="SqlDataSource2" OnItemCommand="DataList2_ItemCommand">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("ProductID") %>'></asp:Label>
<br />
<asp:Label ID="Label2" runat="server" Text='<%#
Bind("ProductName") %>'></asp:Label><br />
<asp:Label ID="Label3" runat="server" Text='<%#
Bind("CategoryID") %>'></asp:Label>
<asp:Button ID="btnEdit" runat="server"
CommandName="Edit" Text="Edit" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("ProductID") %>'></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" Text='<%#
Bind("ProductName") %>'></asp:TextBox>
<asp:Button ID="btnCancel" runat="server"
CommandName="Cancel" Text="Cancel" />
<asp:TextBox ID="TextBox3" runat="server" Text='<%#
Bind("CategoryID") %>'></asp:TextBox>
</EditItemTemplate>
</asp

ataList>
<asp:Button ID="btnCancel" runat="server"
CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
</asp

ataList></div>
========code events=========
protected void DataList1_ItemCommand(object source,
DataListCommandEventArgs e)
{
switch (e.CommandName)
{
case "Edit":
DataList1.EditItemIndex = e.Item.ItemIndex;
DataList1.DataBind();
break;
case "Cancel":
DataList1.EditItemIndex = -1;
DataList1.DataBind();
break;
}
}
protected void DataList2_ItemCommand(object source,
DataListCommandEventArgs e)
{
DataList dl = source as DataList;
switch (e.CommandName)
{
case "Edit":
dl.EditItemIndex = e.Item.ItemIndex;
dl.DataBind();
break;
case "Cancel":
dl.EditItemIndex = -1;
dl.DataBind();
break;
}
}
Hope these help.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)