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

ImageButton Response RadPageView

5 Answers 111 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 23 Sep 2009, 08:47 AM
I have a RadMultiPage with a RadPageView in it.
In the latter one I have an <asp:ImageButton control which should perform a postback to download a file and put it into the response stream. Of course Ajax doesn't allow this because of the partial rendering.

If I try this I get the following error which is understandable:
Error: 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 ...




How should I solve this? How can I force the ImageButton to perform a full postback or is there a better solution?

Thanks,
Stephan

5 Answers, 1 is accepted

Sort by
0
Neal
Top achievements
Rank 1
answered on 14 Jul 2011, 08:02 PM
Was this issue ever resolved I'm a having a similar problem...I have an LinkButton inside a user control, that is inside a RadPageView. There is an AjaxManager Page, I have confirmed that no Ajax Request is made, thus a full post back.

Error I am receiving:

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 '.... (It is a PDF File)

Markup:

Parent Page with PageView

<telerik:RadMultiPage runat="server" ID="rmpSummary" SelectedIndex="0" BorderColor="LightGray" BorderStyle="Solid">
                        <telerik:RadPageView runat="server" ID="rpvGenInfo">
                            <br />
                            <dce:SuccessLabel runat="server" ID="lblSuccess"></dce:SuccessLabel>
                            <dce:ErrorLabel runat="server" ID="lblError"></dce:ErrorLabel>
                            <asp:Label runat="server" ID="lblGenInfoTitle" Text="Investment General Information" SkinID="section"></asp:Label>
                            <br /><br />
                            <UserControl:InvestmentInfo runat="server" ID="ucInvestmentInfo" />
                        </telerik:RadPageView>



User Control Markup

<asp:LinkButton ID="btnK1File" runat="server" OnClick="btnK1File_Click"></asp:LinkButton>


User Control Code Behind
 protected void btnK1File_Click(object sender, EventArgs e)
        {
            bool endResponse = false;
 
            try
            {
                using (var dc = new DCEDataContext())
                {
                    var k1File = (from k in dc.EngagementInvestmentK1Files
                                  where k.EngagementInvestmentID == this.EngagementInvestmentInstance.ID
                                  select new
                                  {
                                      k.FileName,
                                      k.FileBytes
                                  }).FirstOrDefault();
 
                    this.Response.Clear();
                    this.Response.ContentType = "application/octet-stream";
                    this.Response.AppendHeader("Content-Disposition"string.Format("attachment; filename={0}", k1File.FileName));
                    this.Response.BinaryWrite(k1File.FileBytes.ToArray());
                    endResponse = true;
                }
            }
            catch (Exception ex)
            {
                Utility.LogError(ex);
            }
            finally
            {
                if (endResponse)
                    this.Response.End();
            }
        }

0
Dimitar Terziev
Telerik team
answered on 15 Jul 2011, 11:16 AM
Hello Neal,

Please refer to the following help article giving information how to force controls in ajaxified container to perform a full post-back.

Greetings,
Dimitar Terziev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Neal
Top achievements
Rank 1
answered on 15 Jul 2011, 06:38 PM
Dimitar -

I don't think this is going to solve my problem, the javascript to cancel the AJAX request doesn't fire because the control with the Upload Control and button does not trigger an AJAX request...

Here is a simple example snippet I've put together where I was able to have the problem

- ASPX page with Master Page (script manager etc... in master page)
    - Has AJAX Manager, RadTabStrip, RadMultiPageView --> The Tab Strip causes AJAX calls when switching tabs (that should be the only AJAX necessary.

<%@ Register Src="~/UploadControl.ascx" TagName="uc" TagPrefix="ps" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadAjaxManager runat="server" ID="ramEditInvestment">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rtsSummary">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rtsSummary" />
                    <telerik:AjaxUpdatedControl ControlID="rmpSummary" LoadingPanelID="ralp" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="ralp" BackgroundPosition="Top" Skin="Web20" />
    <telerik:RadTabStrip Orientation="HorizontalTop" EnableAjaxSkinRendering="false" runat="server" 
        ID="rtsSummary" Skin="Web20" MultiPageID="rmpSummary" 
        PerTabScrolling="false" AutoPostBack="true">
        <Tabs>
            <telerik:RadTab Value="General"               Text="General"                PageViewID="rpvGenInfo" Selected="true"></telerik:RadTab>
            <telerik:RadTab Value="InvestmentInformation" Text="Investment Information" PageViewID="rpvInvestmentInfo"></telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage runat="server" ID="rmpSummary" SelectedIndex="0" BorderColor="LightGray" BorderStyle="Solid">
        <telerik:RadPageView runat="server" ID="rpvGenInfo">
            <asp:Label runat="server" ID="lblGenInfoTitle" Text="Investment General Information"></asp:Label>
            <ps:uc runat="server" ID="ucTest" />
        </telerik:RadPageView>
        <telerik:RadPageView runat="server" ID="rpvInvestmentInfo">
              
            <asp:Label runat="server" ID="Label1" Text="Investment Information"></asp:Label>
              
        </telerik:RadPageView>
    </telerik:RadMultiPage>
</asp:Content>


- First Page View has the user control in it, which contains an upload control and button (user control below)

<telerik:RadUpload ID="ruK1" runat="server" MaxFileInputsCount="1" ControlObjectsVisibility="ClearButtons"  />
<telerik:RadButton ID="btnAdd" runat="server" Text="Add Investment" Skin="WebBlue" OnClick="btnAdd_Click">
    <Icon PrimaryIconCssClass="rbAdd" />
</telerik:RadButton>

- Code-Behind for User Control (Button Click), which does not fire AJAX Request..

protected void Page_Load(object sender, EventArgs e)
        {
        }
  
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                try
                {
                    string holder = this.ruK1.UploadedFiles.Count.ToString();
                }
                catch (Exception ex)
                {
                }
            }
        }

- The uploaded files is empty and count = 0, If I use this same user control in another page, radwindow, etc.. I have no issues, it only seems to be a problem inside an AJAX-enabled MultiPageView with a Tab Strip
0
Neal
Top achievements
Rank 1
answered on 15 Jul 2011, 06:40 PM
I realized the previous post is a silghtly different problem than originially discussed...

This is in addition to the orginial problem. All related to being inside this AJAX-enabled MultiPageView and TabStrip
0
Dimitar Terziev
Telerik team
answered on 20 Jul 2011, 02:35 PM
Hello Neal,

The reason for the experienced behavior with the RadUpload control, is due to the fact that you couldn't upload files with ajax request. This is just a limitation of the XmlHttpRequest component.

Please refer to the following help article discussing this limitation and how to workaround it.

Kind regards,
Dimitar Terziev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
General Discussions
Asked by
Stephan
Top achievements
Rank 1
Answers by
Neal
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or