using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;

public partial class DynamicContainer : System.Web.UI.UserControl
{
	protected void Page_Load(object sender, EventArgs e)
	{

		Table MyTable = new Table();
		TableRow MyRow = new TableRow();
		TableCell ButtonCell = new TableCell();
		TableCell MyCell = new TableCell();

		UserControl MyControl = (UserControl)Page.LoadControl("WebUserControl.ascx");
		UserControl MyButton = (UserControl)Page.LoadControl("Button.ascx");

		UserControl MyControl2 = (UserControl)Page.LoadControl("WebUserControl.ascx");
		UserControl MyButton2 = (UserControl)Page.LoadControl("Button.ascx"); 

		MyControl.ID = "WebUserControl1";
		MyControl2.ID = "WebUserControl2";
		MyButton.ID = "MyButton1";
		MyButton2.ID = "MyButton2";
		//MyTable.ID = "MyTable";
		//MyRow.ID = "MyRow";
		//ButtonCell.ID = "MyButtonCell";
		//MyCell.ID = "MyCell";

		//ButtonCell.Controls.Add(MyButton);
		//MyCell.Controls.Add(MyControl);
		//MyRow.Cells.Add(MyCell);
		//MyRow.Cells.Add(ButtonCell);
		//MyTable.Rows.Add(MyRow);
		MyPanel1.Controls.Add(MyControl);
		MyPanel1.Controls.Add(MyButton);
		MyPanel1.Controls.Add(MyControl2);
		MyPanel1.Controls.Add(MyButton2);

        System.Web.UI.WebControls.Button btn = (System.Web.UI.WebControls.Button)MyButton.FindControl("btnOk");
        System.Web.UI.WebControls.Button btn2 = (System.Web.UI.WebControls.Button)MyButton2.FindControl("btnOk");

        //AjaxSetting setting2 = new AjaxSetting("Container1_MyButton2_btnOk");
        //AjaxUpdatedControl updated2 = new AjaxUpdatedControl();

        //AjaxSetting setting = new AjaxSetting(btn.ID);
        //AjaxUpdatedControl updated = new AjaxUpdatedControl();

        //updated.ControlID = MyControl.ID;
        //setting.UpdatedControls.Add(updated);
        //setting.UpdatedControls.Add(updated2);
        //RadAjaxManager1.AjaxSettings.Add(setting);

        //updated2.ControlID = MyControl2.ID;
        //setting2.UpdatedControls.Add(updated2);
        //setting2.UpdatedControls.Add(updated);

        //RadAjaxManager1.AjaxSettings.Add(setting2);

        RadAjaxManager1.AjaxSettings.AddAjaxSetting(MyPanel1, MyPanel1);
	}

}
