1

我想动态创建ajax dragpanel并动态添加控件和面板。我使用下面的代码动态创建控件。但是我不能拖动它。

enter code here

protected void Page_PreInit(object sender, EventArgs e)
{
    DragPanelExtender drg = new DragPanelExtender();
    drg.ID = "drg_1";
    drg.DragHandleID = "pnl_1";
    drg.TargetControlID = "pnl_2";
    Panel p1 = new Panel();
    p1.ID = "pnl_1";
    Panel p2 = new Panel();
    p2.ID = "pnl_2";
    Label l1 = new Label();
    l1.Text = "First";
    TextBox t = new TextBox();
    t.Text = "Enter text";
    p2.Controls.Add(l1);
    p2.Controls.Add(t);
    p1.Controls.Add(p2);
    Page.Controls.Add(p1);
}

如何在面板内创建拖动控件

4

0 回答 0