I have the following setup as shown in the markup below. There is an ajaxified panel which contains an imagebutton and a hyperlink. Clicking on either of these opens a rad Window, which has a close handler. The close handler initiates the "click" event of a hidden button in order for me to be able to run some server-side code after the window closes. When I open the radwindow using the hyperlink, everything works as expected. When I do so using the image button, I get the following non-descript javascript error when the hidden button .click event is raised.
Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405
This error doesn not occur if I don't ajaxify the panel.
I have tried to research this error and track down the cause, but to no avail. When I look at this in Fiddler, I notice the URL that fiddler errors on is .{my path}/javascript:void(0);. I don't know where the javascript:void(0); comes from... but I obviously include that in the Imagebutton PostbackUrl to prevent a postback when the imagebutton is clicked. I also don't know why this piece of the imagebutton declaration would have anything to do with this since the error occurs on the attempt to raise the hidden button's click event.
Any Idea why the image button implementation wouldn't work, while the hyperlink does?
Markup:
In code-behind, I ajaxify the panel using an ajaxmanager which is part of my page base class:
Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405
This error doesn not occur if I don't ajaxify the panel.
I have tried to research this error and track down the cause, but to no avail. When I look at this in Fiddler, I notice the URL that fiddler errors on is .{my path}/javascript:void(0);. I don't know where the javascript:void(0); comes from... but I obviously include that in the Imagebutton PostbackUrl to prevent a postback when the imagebutton is clicked. I also don't know why this piece of the imagebutton declaration would have anything to do with this since the error occurs on the attempt to raise the hidden button's click event.
Any Idea why the image button implementation wouldn't work, while the hyperlink does?
Markup:
<
telerik:RadCodeBlock
ID
=
"rcb1"
runat
=
"server"
>
<
script
language
=
"javascript"
>
function OpenDialog() {
var oWin = radopen('http://www.yahoo.com', '');
oWin.add_close(Refresh);
}
function Refresh() {
$get('<%= tiReloader.ClientID %>').click();
}
</
script
>
</
telerik:RadCodeBlock
>
<
asp:ScriptManager
ID
=
"MyScriptManager"
runat
=
"server"
AsyncPostBackTimeout
=
"7200"
></
asp:ScriptManager
>
<
telerik:RadAjaxLoadingPanel
id
=
"lpGlobal"
Runat
=
"server"
Transparency
=
"18"
CssClass
=
"AjaxLoadingProgress"
></
telerik:RadAjaxLoadingPanel
>
<
asp:Panel
id
=
"pnlT"
runat
=
"Server"
height
=
"400px"
>
<
asp:Button
ID
=
"tiReloader"
runat
=
"server"
Text
=
"Button"
style
=
"display:none;"
/>
<
asp:ImageButton
id
=
"ib"
runat
=
"Server"
ImageUrl
=
"~/global/images/icons/edit.png"
AlternateText
=
"Open Dialog from Image Button"
ImageAlign
=
"AbsMiddle"
PostBackUrl
=
"javascript:void(0);"
OnClientClick
=
"OpenDialog()"
/><
br
/><
br
/>
<
asp:Hyperlink
id
=
"hl"
runat
=
"Server"
target
=
"_self"
navigateurl
=
"javascript:OpenDialog();"
>Open Dialog from Hyperlink</
asp:Hyperlink
>
</
asp:Panel
>
In code-behind, I ajaxify the panel using an ajaxmanager which is part of my page base class:
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
SetAjaxManagerSettings()
End
Sub
Private
Sub
SetAjaxManagerSettings()
Me
.AddAjaxSetting(pnlT, pnlT, lpGlobal, Unit.Percentage(100), Web.UI.UpdatePanelRenderMode.Block )
End
Sub
Private
Sub
tiReloader_Click(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
tiReloader.Click
Threading.Thread.Sleep(500)
End
Sub
Public
Sub
AddAjaxSetting(
ByVal
initiatorControl
As
Control,
ByVal
updatedControl
As
Control,
ByVal
loadingPanel
As
RadAjaxLoadingPanel,
ByVal
updatePanelHeight
As
Unit,
ByVal
updatePanelRenderMode
As
UpdatePanelRenderMode)
Dim
ajaxManager
As
RadAjaxManager = Telerik.Web.UI.RadAjaxManager.GetCurrent(
Me
)
If
ajaxManager IsNot
Nothing
Then
If
initiatorControl IsNot
Nothing
And
updatedControl IsNot
Nothing
Then
Dim
setting
As
AjaxSetting =
New
AjaxSetting
ajaxManager.AjaxSettings.Add(setting)
setting.AjaxControlID = initiatorControl.ID
Dim
ajxUpdatedControl
As
New
AjaxUpdatedControl()
ajxUpdatedControl.ControlID = updatedControl.ID
If
loadingPanel IsNot
Nothing
Then
ajxUpdatedControl.LoadingPanelID = loadingPanel.ID
End
If
setting.UpdatedControls.Add(ajxUpdatedControl)
ajxUpdatedControl.UpdatePanelRenderMode = updatePanelRenderMode
If
Not
updatePanelHeight.IsEmpty
Then
ajxUpdatedControl.UpdatePanelHeight = updatePanelHeight
End
If
Else
Throw
New
Exception(
"The initiatorControl or updatedControl is NULL. Cannot add AjaxSetting."
)
End
If
Else
Throw
New
Exception(
"Telerik RadAjaxManager not found on page. Set UseSharedAjaxManager property to True in Page_Init event or add a Telerik RadAjaxManager control to the page."
)
End
If
End
Sub