Hi There,
What I'm trying to achieve looks pretty simple and works well with GridViews, but for some reason I just can't get it to work with a ListView control.
Here's what I'm doing :
On my default.aspx page I have an aspPanel, with a RadAjaxManager. Within that panle I dynamically load usercontrols such as the ones embedding the RadGridView mentioned earlier. When I click on a GridItem from those GridView to download some file, obviously I need to prevent this to happen through an Ajax request to make it work.
Hence, my js handler ClientEvents-OnRequestStart="requestsStart" and my js function looks like the following:
As I said everything works fine from my GridViews. here my usercontrol code that embeds the ListView :
When I click on any item, it does not even display the console.log('test' + blablabla) that is in my js requestStart function. It's like it doesn't care about the AjaxManager.
I tried to specifically indicate those controls to the RadAjaxMgr a below but even then it never enter my js function:
And then I end up with the following error message that makes it obvious my request was ajaxified by the manager :
"Sys.WebForms.PageRequestManagerParserErrorException: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '%PDF-1.5
%����
1 0'."
Idea ?
Cheers,
Chris
What I'm trying to achieve looks pretty simple and works well with GridViews, but for some reason I just can't get it to work with a ListView control.
Here's what I'm doing :
On my default.aspx page I have an aspPanel, with a RadAjaxManager. Within that panle I dynamically load usercontrols such as the ones embedding the RadGridView mentioned earlier. When I click on a GridItem from those GridView to download some file, obviously I need to prevent this to happen through an Ajax request to make it work.
Hence, my js handler ClientEvents-OnRequestStart="requestsStart" and my js function looks like the following:
1.
function
requestsStart(ajaxManager, eventArgs) {
2.
console.log(
"test : "
+ eventArgs.get_eventTarget());
3.
if
(eventArgs.get_eventTarget().indexOf(
"Download"
) != -1) {
4.
eventArgs.set_enableAjax(
false
);
5.
}
6.
}
As I said everything works fine from my GridViews. here my usercontrol code that embeds the ListView :
01.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="feature-doc-download.ascx.cs"
02.
Inherits="NRP.Study.usercontrols.feature_doc_download" %>
03.
<
link
href
=
"css/feature-doc-download.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
04.
<
telerik:RadListView
ID
=
"RlvListDocuments"
runat
=
"server"
OnNeedDataSource
=
"RlvListDocuments_NeedDataSource"
05.
DataKeyNames
=
"ID"
ItemPlaceholderID
=
"IPListDocuments"
OnItemCommand
=
"RlvListDocuments_ItemCommand"
06.
AllowPaging
=
"true"
PageSize
=
"12"
>
07.
<
LayoutTemplate
>
08.
<
table
>
09.
<
tr
>
10.
<
td
>
11.
<
asp:PlaceHolder
ID
=
"IPListDocuments"
runat
=
"server"
></
asp:PlaceHolder
>
12.
</
td
>
13.
</
tr
>
14.
<
tr
>
15.
<
td
>
16.
<
telerik:RadDataPager
ID
=
"RadDataPager1"
runat
=
"server"
PagedControlID
=
"RlvListDocuments"
17.
PageSize
=
"12"
>
18.
<
Fields
>
19.
<
telerik:RadDataPagerButtonField
FieldType
=
"FirstPrev"
></
telerik:RadDataPagerButtonField
>
20.
<
telerik:RadDataPagerButtonField
FieldType
=
"Numeric"
></
telerik:RadDataPagerButtonField
>
21.
<
telerik:RadDataPagerButtonField
FieldType
=
"NextLast"
></
telerik:RadDataPagerButtonField
>
22.
</
Fields
>
23.
</
telerik:RadDataPager
>
24.
</
td
>
25.
</
tr
>
26.
</
table
>
27.
</
LayoutTemplate
>
28.
<
ItemTemplate
>
29.
<
asp:LinkButton
ID
=
"BtnDownload"
runat
=
"server"
CommandName
=
"Download"
CommandArgument='<%#Eval("ID") %>'>
30.
<
div
class
=
"docTile"
>
31.
<
table
>
32.
<
tr
>
33.
<
td
rowspan
=
"2"
>
34.
<
div
class
=
"iconWrapper"
>
35.
<
img
src='<%#Eval("IconUrlLarge") %>' alt='' class="docTypeIcon" />
36.
</
div
>
37.
</
td
>
38.
<
td
class
=
"fileName"
>
39.
<%#Eval("FileName") %>
40.
</
td
>
41.
</
tr
>
42.
<
tr
>
43.
<
td
class
=
"Comment"
>
44.
<%#Eval("Comment") %>
45.
</
td
>
46.
</
tr
>
47.
</
table
>
48.
</
div
>
49.
</
asp:LinkButton
>
50.
</
ItemTemplate
>
51.
<
AlternatingItemTemplate
>
52.
<
asp:LinkButton
ID
=
"BtnDownload"
runat
=
"server"
CommandName
=
"Download"
CommandArgument='<%#Eval("ID") %>'>
53.
<
div
class
=
"docTile"
>
54.
<
table
>
55.
<
tr
>
56.
<
td
rowspan
=
"2"
>
57.
<
div
class
=
"iconWrapper"
>
58.
<
img
src='<%#Eval("IconUrlLarge") %>' alt='' class="docTypeIcon" />
59.
</
div
>
60.
</
td
>
61.
<
td
class
=
"fileName"
>
62.
<%#Eval("FileName") %>
63.
</
td
>
64.
</
tr
>
65.
<
tr
>
66.
<
td
class
=
"Comment"
>
67.
<%#Eval("Comment") %>
68.
</
td
>
69.
</
tr
>
70.
</
table
>
71.
</
div
>
72.
</
asp:LinkButton
>
73.
</
AlternatingItemTemplate
>
74.
<
EmptyDataTemplate
>
75.
</
EmptyDataTemplate
>
76.
</
telerik:RadListView
>
When I click on any item, it does not even display the console.log('test' + blablabla) that is in my js requestStart function. It's like it doesn't care about the AjaxManager.
I tried to specifically indicate those controls to the RadAjaxMgr a below but even then it never enter my js function:
01.
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
OnAjaxRequest
=
"RadAjaxManager1_AjaxRequest"
ClientEvents-OnRequestStart
=
"requestsStart"
>
02.
<
AjaxSettings
>
03.
<
telerik:AjaxSetting
AjaxControlID
=
"RlvListDocuments"
>
04.
<
UpdatedControls
>
05.
<
telerik:AjaxUpdatedControl
ControlID
=
"RlvListDocuments"
/>
06.
</
UpdatedControls
>
07.
</
telerik:AjaxSetting
>
08.
</
AjaxSettings
>
09.
</
telerik:RadAjaxManager
>
And then I end up with the following error message that makes it obvious my request was ajaxified by the manager :
"Sys.WebForms.PageRequestManagerParserErrorException: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '%PDF-1.5
%����
1 0'."
Idea ?
Cheers,
Chris