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

Problem in Ajax post back

1 Answer 86 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Velkumar
Top achievements
Rank 2
Velkumar asked on 01 Mar 2012, 01:37 PM
Hi,

I have a radpanelbar in a RadAjaxUpdate panel . I need to post back the page when i click or expand  the radpanel item . But got an error.
System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).    at System.Web.UI.ControlCollection.AddAt(Int32 index, Control child)     at Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated)   

I have the following code
<telerik:RadAjaxPanel ID="DemoPanelBarPanel" runat="server" EnableAJAX="true">
 
    <telerik:RadPanelBar ID="uxProfileList" OnClientItemClicked="OnClientItemExpand" OnClientItemExpand="OnClientItemExpand" ExpandMode="FullExpandedItem" Width="100%" runat="server">
 
                            <Items>
                                <telerik:RadPanelItem runat="server" Text="Personal Info" Value="PersonalInfo" Font-Bold="true"  >
                                </telerik:RadPanelItem>
                                <telerik:RadPanelItem runat="server" Text="Profile Info" Value="ProfileInfo" Font-Bold="true" >
                                </telerik:RadPanelItem>
                                <telerik:RadPanelItem runat="server" Text="Education" Value="Education" Font-Bold="true" >
                                </telerik:RadPanelItem>
                                <telerik:RadPanelItem runat="server" Text="WorkExperience" Value="WorkExperience" Font-Bold="true" >
                                </telerik:RadPanelItem>
                            </Items>
 
                        </telerik:RadPanelBar>
</telerik:RadAjaxPanel>
<script  type="text/javascript" language="javascript">
 
    function OnClientItemExpand(sender, args) {
 
 
 
        $find("<%= DemoPanelBarPanel.ClientID%>").ajaxRequestWithTarget("<%= DemoPanelBarPanel.ClientID%>", args.get_item().get_value());
 
 
    }    
</script>
DemoPanelBarPanel.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(OnProfileAjaxPanelAjaxRequest);
void OnProfileAjaxPanelAjaxRequest(object sender, AjaxRequestEventArgs e)
       {
          if (e.Argument.Equals("PersonalInfo"))
           {
              RadPanelItem item = uxProfileList.Items.FindItemByValue(e.Argument);
           }
       }

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar Terziev
Telerik team
answered on 05 Mar 2012, 09:22 AM
Hi,

Please try to enclose your javascript in a RadCodeBlock and check whether the problem persists.
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
          <script type="text/javascript" language="javascript">
 
              function OnClientItemExpand(sender, args) {
 
 
 
                  $find("<%= DemoPanelBarPanel.ClientID%>").ajaxRequestWithTarget("<%= DemoPanelBarPanel.ClientID%>", args.get_item().get_value());
 
 
              }   
          </script>
      </telerik:RadCodeBlock>

All the best,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
PanelBar
Asked by
Velkumar
Top achievements
Rank 2
Answers by
Dimitar Terziev
Telerik team
Share this question
or