Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

UpdatePanel Do Full postback on Dynamic WebControls

$
0
0

Hello 

I am searching for a solution for over 20 days,  The problem appears only when I load Web Users Controls as Dynamic in the Default.aspx,

If I add the by drag it into the page as Static , there is no problem.  

This is how the code in default.aspx for static (fixed) 

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><uc1:WebControl1 runat="server" ID="WebControl" /></asp:Content>



I have a Masterpage and Default.aspx and many web controls, 

I add ScriptManager in the MasterPage as following 

<form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"></asp:ScriptManager><div><asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder></div></form>

and I added the Following in the Default.aspx Page 

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"></asp:Content>


I used the following code in the Default.aspx.cs (Code Behind) File to load the pages based on passed parameters 

 // find the place holder
ContentPlaceHolder mainContent = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
 // load the control
//page name is the webcontrol name and its source
Control MyControl = (Control)LoadControl(pagename);
// add the control
mainContent.Controls.Add(MyControl);

I used the following code in the Webcontrol.ascx 

<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>

some controls such as datagrid, buttons and dropdowns 

    </ContentTemplate></asp:UpdatePanel>

and in the code behind 

 if (IsPostBack == true)
        {
            ScriptManager.GetCurrent(Page).RegisterPostBackControl(Submitbtn);
        }

I hope I can find solution like everytime. 

Thanks 


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>