Error parsing near Telerik.Web.UI.2008

8 posts, 0 answers
  1. Waleed Seada
    Waleed Seada avatar
    241 posts
    Member since:
    May 2006

    Posted 26 May 2008 Link to this post

    Hello All,
    I have build a complex interface with many RadControls on it.

    I finally loaded a usercontrols dynamically, when I receive this error message:
    Sys.WebForms.PageRequestManagerParserErrorException: the message from the server can not be parsed .........
    Details: error parsing near 'Telerik.Web.UI.2008'

    The message appears randomly, I don't know where could be the issue ...

    Best regards
    Waleed
  2. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 26 May 2008 Link to this post

    Hi Waleed Seada,

    Thank you for your interest in RadControls.

    I will appreciate if you provide a demo application which can be debugged locally. Thus we will provide more straight-to-the-point explanation/solution.

    Regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Waleed Seada
    Waleed Seada avatar
    241 posts
    Member since:
    May 2006

    Posted 26 May 2008 Link to this post

    Dear Daniel,

    I opened a support ticket with sample application attahced.

    I Hope you can re-produce the same error...

    Support ticket number : 140149

    Best regards
    Waleed
  5. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 29 May 2008 Link to this post

    Hi Waleed,

    We have examined the code you have sent and found that the paging problem is caused by your user control loading routine. Can you please try removing this line parent.Controls.Clear(); from your LoadUserControl method and see if it helps.

    Best wishes,
    Rosen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Waleed Seada
    Waleed Seada avatar
    241 posts
    Member since:
    May 2006

    Posted 29 May 2008 Link to this post

    Hello Rosen,

    It helps the paging, but the controls are added at the same time, which is not what I want, beside that if I clicked on the same link twice, I will receive error of adding the same control ID.

    Best,
    Waleed
  7. Baatezu
    Baatezu avatar
    110 posts
    Member since:
    Aug 2007

    Posted 29 May 2008 Link to this post

    This is kinda a work around/hack, but it has worked for me when I do dynamic loading

    Can you check for the existence of the control before you add it? That way you don't add it twice if it already exists.

    Instead of completely removing parents.Controls.Clear(), I'd do
    Control control = parent.FindControl("myControl"); 
    if(control != null
        parents.Controls.Remove(control); 
    This way it won't remove any other controls that are created in whatever object you are trying to insert it into. You can build off this as well to implement my other suggestion since it already checks if the control exists or not. :)
  8. Waleed Seada
    Waleed Seada avatar
    241 posts
    Member since:
    May 2006

    Posted 01 Jun 2008 Link to this post

    Hello Baatezu,

    I try to achieve this before cause I want to remove the overhead re-loading the same control many time, when the user click on the same link more than once, when a strange and unexpected result occur; FindControl couldn't fine the control with the ID.

    In the debug mode you can see that if you test the same function after adding the control it will work fine, but not in the next trip (same call to load the user control).

    This what happen when I try to use your code here.

    /Edit : same date
    I only want to have one usercontrol loaded in the panel.

    Thanks and Best regards,
    Waleed
  9. Waleed Seada
    Waleed Seada avatar
    241 posts
    Member since:
    May 2006

    Posted 01 Jun 2008 Link to this post

    Hello Guys,

    Based on proposed solution, I comment the clear() method when loading user controls dynamically and I substituted the validation to be for any loaded control to be removed using remove() method.

        public void LoadUserControl(string controlName, Control parent)  
        {  
            string userControlID = ((controlName.Split('.')[0]).Replace("/""")).Replace("~""");  
            //Remove the prevuios loaded control, instead of parent.Controls.Clear() which can cause random problem  
            Control control = parent.FindControl(((CurrentControl.Split('.')[0]).Replace("/""")).Replace("~"""));  
            if (control != null)  
            {  
                parent.Controls.Remove(control);  
            }  
            UserControl MyControl = (UserControl)LoadControl(controlName);  
            MyControl.ID = userControlID;  
            parent.Controls.Add(MyControl);  
            CurrentControl = controlName;  
        } 

    It is working fine so far, and the paging is fine as well  ....

    Best regards,
    Waleed
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017