Hi dear,
i am using Ajax's DragPanelExtender.
I have created one user control of this.
I am trying to add this at run time on my master page but only first control is working.
I had checked ids of each control each time they are not repeated.
My code is
User control code
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ACT" %>
<table>
<tr>
<td>
<ACT:DragPanelExtender ID="DPE_TextComments" runat="server" TargetControlID="panel_TextComments"
DragHandleID="img_Drag">
</ACT:DragPanelExtender>
<asp:Panel ID="panel_TextComments" runat="server" BackColor="Snow" Width="250" HorizontalAlign="Center">
<asp:Panel ID="PanelText" runat="server">
<asp:TextBox runat="server" ID="txt_comments" Width="100%" Height="100%" TextMode="MultiLine">
</asp:TextBox>
</asp:Panel>
<ACT:ResizableControlExtender ID="RCE_Textbox" runat="server" TargetControlID="PanelText"
ResizableCssClass="resizingText" HandleCssClass="handleText" OnClientResizing="OnClientResizeText" />
<%-- <asp:TextBox ID="txt_comments" runat="server"></asp:TextBox>--%>
<asp:Image ID="img_Drag" runat="server" ImageUrl="~/Images/Drag_Icon.gif" />
</asp:Panel>
</td>
</tr>
</table>
Button Click code
Here PH_Master_Page is place holder on master page and Movable_Text is user control.
li_Count is a static variable incremented each time when new control created
protected void Page_Init(object sender, System.EventArgs e)
{
if (li_Count != 0)
{
for (int i = 1; i <= li_Count; i++)
{
Movable_Text mt = new Movable_Text();
mt = LoadControl("~/Controls/Movable_Text.ascx") as Movable_Text;
this.PH_Master_Page.Controls.Add(mt);
}
}
}
protected void btn_New_Comment_Click(object sender, EventArgs e)
{
Create_New_Control();
}
public void Create_New_Control()
{
try
{
Movable_Text mt = new Movable_Text();
mt = LoadControl("~/Controls/Movable_Text.ascx") as Movable_Text;
this.PH_Master_Page.Controls.Add(mt);
li_Count++;
}
catch { }
}
When first DragExtender Panel is added it can moved properly but when next control added it is not moved.
Please please help me for this