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

RadAjaxLoadingPanel does not show up with custom user controls [Resolved]

1 Answer 188 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 27 May 2009, 03:55 PM
I resolved this issue myself; Just in case anybody else runs into the same problem, I'll post it here...

I created a user control and a RadAjaxManager for Ajax support.  The RadAjaxLoadingPanel was not showing up on Ajax operations.  So I decided to manually show/hide the loading panel by using RadAjaxManager.ClientEvents.  However, OnRequestStart and OnResponseEnd were not being triggered for some reason.  So I hooked into the Sys.WebForms.PageRequestManager instance and added a listener for beginRequest and endRequest.

So I got that working and tried to show the RadAjaxLoadingPanel.  That's when I realized the problem.  RadAjax was trying to reference my user control client-side using ClientID.  However, I inherit from System.Web.UI.UserControl which does not have a wrapper containing the control ClientID.  So there was nothing to reference in the generated HTML.  After wrapping my user control in a div with its ClientID, RadAjaxManager.ClientEvents began to throw the OnRequestStart and OnResponseEnd events correctly, and the RadAjaxLoadingPanel worked without additional coding on the client-side.

I don't know if this is the best way, but this is the code I used to resolve this issue:
    Public Overrides Sub RenderControl(ByVal writer As System.Web.UI.HtmlTextWriter) 
        writer.AddAttribute(HtmlTextWriterAttribute.Id, Me.ClientID) 
        writer.RenderBeginTag(HtmlTextWriterTag.Div) 
        MyBase.RenderControl(writer) 
        writer.RenderEndTag() 
    End Sub 

Hope this helps!

1 Answer, 1 is accepted

Sort by
0
Joe
Top achievements
Rank 2
answered on 07 Nov 2009, 03:24 PM
Thanks Kevin,
Although my situation was a little different, and I couldn't get your solution to work, I thought I would post my scenario and solution here as well...

I have a user control which contains a RadAjaxManager. Apparently client-side events, specifically OnRequestStart and OnResponseEnd, do not work in a user control with RadAjaxManager (As Kevin described).

Since I only really needed to ajaxify one control the solution for me was simply to replace RadAjaxMananger with a RadAjaxPanel and it worked great.

Thanks
Tags
Ajax
Asked by
Kevin
Top achievements
Rank 1
Answers by
Joe
Top achievements
Rank 2
Share this question
or