This is a migrated thread and some comments may be shown as answers.

add RadAjaxPanel programmatically

2 Answers 103 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
July
Top achievements
Rank 2
July asked on 02 Aug 2011, 07:21 PM
How is the way to add radAjaxPanel programmatically?
I have a MasterPage . I need added in content.
I tried with this in Init event of page:

         RadAjaxPanel radajaxPanel = new RadAjaxPanel();
         radajaxPanel.ID="RadAjaxPanel3";
         radajaxPanel.ClientEvents.OnRequestStart = "conditionalPostback";

         containerUpload.Controls.Add(radajaxPanel);           


but didn't work
thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Genti
Telerik team
answered on 03 Aug 2011, 12:48 PM
Hello Julieta,

If you wan to add an AjaxPanel into some placeholder from the codebehind, then you can do the following:

protected void Page_Init(object sender, EventArgs e)
{
    RadAjaxPanel rap1 = new RadAjaxPanel();
    rap1.ID = "ajaxPanel1";
    Button btn1 = new Button();
    btn1.ID = "btn1";
    Label lbl1 = new Label();
    lbl1.ID = "lbl1";
 
    rap1.Controls.Add(btn1);
    rap1.Controls.Add(lbl1);
 
    PagePlaceHolder.Controls.Add(rap1);
 
    btn1.Click += new EventHandler(btn1_Click);
 
}
void btn1_Click(object sender, EventArgs e)
{
    Label labelInsidePanel = (PagePlaceHolder.FindControl("ajaxPanel1") as RadAjaxPanel).FindControl("lbl1") as Label;
    labelInsidePanel.Text = DateTime.Now.ToString();
}

Regards,
Genti
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
July
Top achievements
Rank 2
answered on 03 Aug 2011, 01:20 PM
Thanks! that Is exactly what I need!!
THANKS!!!!
Tags
General Discussions
Asked by
July
Top achievements
Rank 2
Answers by
Genti
Telerik team
July
Top achievements
Rank 2
Share this question
or