Hi,
I'm basically trying to get this to work:
http://blogs.telerik.com/blogs/posts/09-02-25/handling_onajaxrequest_in_content_pages_with_ajax_proxy.aspx
But in a Master/content page situation with ajax settings and with handlers for OnResponseEnd and OnRequestStart.
I must be missing something really obvious, but I can't for the life of me get this to work. I'm going to paste my code, BUT -- can you all PLEASE post those files to the blog post that are supposed to work? I have a hard time understanding why this doesn't work when I feel like I've followed all the instructions...
Aspx - Master
Aspx - Content
C#
OH.. I just tried one more thing, I removed the PlaceHolder ID="phValid" and it works now. I suppose somehow I have a bug in what I'm determining is valid. Though I'll look dumb keeping this post up, maybe it'll help someone else with similar issues.
Apparently, in my Master Page, the Page_Init call is getting called in the lifecycle somewhere of the ajax call and in that case it's "invalid" by my code logic causing the content area to not be updated correctly...
I'm basically trying to get this to work:
http://blogs.telerik.com/blogs/posts/09-02-25/handling_onajaxrequest_in_content_pages_with_ajax_proxy.aspx
But in a Master/content page situation with ajax settings and with handlers for OnResponseEnd and OnRequestStart.
I must be missing something really obvious, but I can't for the life of me get this to work. I'm going to paste my code, BUT -- can you all PLEASE post those files to the blog post that are supposed to work? I have a hard time understanding why this doesn't work when I feel like I've followed all the instructions...
Aspx - Master
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:PlaceHolder
ID
=
"phValid"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"rsm"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<
div
class
=
"pnlCourseMainContentDialog"
>
<
asp:ContentPlaceHolder
id
=
"cphMain"
runat
=
"server"
>
</
asp:ContentPlaceHolder
>
</
div
>
</
asp:PlaceHolder
>
Aspx - Content
<
telerik:RadAjaxManagerProxy
ID
=
"RadAjaxManagerProxy1"
runat
=
"server"
>
</
telerik:RadAjaxManagerProxy
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
window.$ = $telerik.$;
function get_RadWindow() { var oWindow = null; if (window.radWindow) { oWindow = window.radWindow; } else if ((window.frameElement) && (window.frameElement.radWindow)) { oWindow = window.frameElement.radWindow; } return oWindow; }
function JustClose() { get_RadWindow().Close(); }
function fileUploaded(sender, eventArgs) {
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest();
}
function requestStart(sender, eventArgs) {
}
function responseEnd(sender, eventArgs) {
var oWnd = get_RadWindow();
var oArg = new Object();
oArg.id = $("#<%= hfId.ClientID %>").val();
alert('Id is: ' + oArg.id + " ");
/*
//Close the RadWindow and send the argument to the parent page
if (oWnd)
oWnd.close(oArg);
*/
}
function test() {
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest();
}
</
script
>
</
telerik:RadCodeBlock
>
<
asp:HiddenField
ID
=
"hfId"
runat
=
"server"
/>
<
asp:TextBox
ID
=
"tbId"
runat
=
"server"
></
asp:TextBox
>
<
input
type
=
"button"
onclick
=
"test()"
/>
C#
}
protected
void
manager_AjaxRequest(
object
sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
//handle the manager AjaxRequest event here
hfId.Value =
"100"
;
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
manager.ClientEvents.OnRequestStart =
"requestStart"
;
manager.ClientEvents.OnResponseEnd =
"responseEnd"
;
manager.AjaxRequest +=
new
RadAjaxControl.AjaxRequestDelegate(manager_AjaxRequest);
manager.AjaxSettings.AddAjaxSetting(manager,
this
.hfId);
}
OH.. I just tried one more thing, I removed the PlaceHolder ID="phValid" and it works now. I suppose somehow I have a bug in what I'm determining is valid. Though I'll look dumb keeping this post up, maybe it'll help someone else with similar issues.
Apparently, in my Master Page, the Page_Init call is getting called in the lifecycle somewhere of the ajax call and in that case it's "invalid" by my code logic causing the content area to not be updated correctly...