Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...re:asp.net ajax problem in mymodulere:asp.net ajax problem in mymodule
Previous
 
Next
New Post
4/23/2008 12:33 AM
 

Hi All,

         I have a module which has different panels in a control and a tabbed interface.Based on this selection panels are shown.I used "Supports partial Rendering" for this control.Everything worked fine with the ajax functionality i mean when i click on tabs the corresponding panels are displayed without refreshing.But i added a link in the panels called "export to excel" and wrote its functionality.I get an excel file if i uncheck the option "Supports partial Rendering".But when i check that option since i want the panels to be shown without page refresh i have checked the partial rendering functionality.When this is checked i get the following error.The following is the sample code i have written for the link.

    Protected Sub competencygridexport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles competencygridexport.Click

            Response.Clear()

            Response.AddHeader("content-disposition", "attachment;filename=myexcelfile.xls")
            Response.Charset = ""
            Response.Cache.SetCacheability(HttpCacheability.Public)
            Response.ContentType = "application /vnd.xls"


            Dim StringWriter As New StringWriter
            Dim htmlWrite As New HtmlTextWriter(StringWriter)
            htmlWrite.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Html)
            lstCompetencies.HeaderStyle.Font.Bold = True
            lstCompetencies.GridLines = GridLines.Both

            lstCompetencies.Columns(2).Visible = False
            lstCompetencies.Columns(3).Visible = False
            lstCompetencies.Columns(4).Visible = False

            lstCompetencies.AllowPaging = False
            lstCompetencies.AllowSorting = False

            'Render(htmlWrite)

            lstCompetencies.RenderControl(htmlWrite)
            htmlWrite.RenderEndTag()
            Response.Write(StringWriter)
            Response.End()
        End Sub

The error i get is a javascript popup which contains the following text in it.All the function executes fine and finally i get the javascriptpop up so i can say there is a pbm with this ajax stuff and not with my code since i am able to export it when the ajax functionality is disabled i mean "Supports partial rendering" is turned off.

Sys.WebForms.PageRequestManagerParseErrorException: The message recieved 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,Http Modules, or server trace is enabled..so on.

Why is this occuring.please help.I really need the ajax functionality to be working but with this excel option i cannot.Its urgent.Thanks in advance.

Regards,

Sandeep.M

 
New Post
4/23/2008 11:42 AM
 

please can somebody help.I am totally out of clues and i need it badly.

Thanks,

Sandeep.M

 
New Post
4/23/2008 11:49 AM
 

Hi Sandeep,

You appear to be experiencing this issue because your Excel export link requires a full postback, but is configured to use an aynchronous postback.  This is because *all* postbacks within the DNN UpdatePanel wrapper are asynchronous unless you arrange otherwise.

I believe that you can remedy this issue by wrapping your control in a new UpdatePanel, and adding a <Trigger><asp:PostBackTrigger ControlID="YourExcelExportLinkControlId" /></Trigger> inside its body.

It may also be possible to add the trigger to the DNN UpdatePanel wrapper via code, but I am not sure offhand if the framework provides a good way to access this control.  It's not something that I've needed to do before.

Hope this points you in the right direction!

Brandon


Brandon Haynes
BrandonHaynes.org
 
New Post
4/24/2008 1:42 AM
 

Hi Brandon and All,

               I have done some research and found using Response.write() causes this error while using ajax update panels.But i really dont use it but the framework internally uses them i think so since i created only normal panels and inside them i have added grids to display the data.Some of the sites say use label etc instead of response.write().How can this be done??

Brandon you mean i need to change all the panels to update panels?? please can you post a sample code.I am pasting myn please check and say how can i change it.

<

asp:Panel id="pnlCompetencies" runat="server" visible="true" BackColor="#F8F8F8" Width="620px">

 

<table border="0" cellpadding="4" cellspacing="0">

 

 

<tr><td align="center">

 

<img src="~images/trans.gif" width="10px" height="0" alt="" />

 

 

<asp:datagrid id="lstCompetencies" AutoGenerateColumns="false" width="600px" DataKeyField="CompetencyId"AllowPaging="True" CellPadding="4" GridLines="none" cssclass="DataGrid_Container" runat="server">

 

<headerstyle CssClass="NormalBold" verticalalign="Top" horizontalalign="Center" BackColor="white" />

 

<itemstyle cssclass="Normal" horizontalalign="Center" />

 

<columns>

 

<asp:TemplateColumn ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">

 

<itemtemplate>

 

<asp:label runat="server" text='<%# DataBinder.Eval(Container.DataItem,"CompetencyName") %>' Height="20" ></asp:label>

 

</ItemTemplate>

 

</asp:TemplateColumn>

 

<asp:TemplateColumn ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >

 

<itemtemplate>

 

<asp:label ID="Label1" runat="server" text='<%# DataBinder.Eval(Container.DataItem,"CatogeryName") %>' Height="20" ></asp:label>

 

</ItemTemplate>

 

</asp:TemplateColumn>

 

 

<asp:TemplateColumn>

 

<itemtemplate>

 

<asp:Image ToolTip='<%# DataBinder.Eval(Container.DataItem,"StatusName") %>' ID="Image1" runat="server" Width="20" ImageUrl='<%# DataBinder.Eval(Container, "DataItem.ImagePath") %>' Height="20" ></asp:Image>

 

</ItemTemplate>

 

</asp:TemplateColumn>

 

<asp:TemplateColumn>

 

<itemtemplate>

 

<asp:HyperLink ToolTip="Edit Competency" id="EditCompetency" ImageUrl="~/images/edit.gif" NavigateUrl='<%# EditUrl("CompetencyId",DataBinder.Eval(Container.DataItem,"CompetencyId"),"EditCompetency") %>' runat="server" />

 

</ItemTemplate>

 

</asp:TemplateColumn>

 

 

<asp:TemplateColumn>

 

<ItemTemplate>

 

<asp:ImageButton ToolTip="Delete Competency" runat="server" ID="lnkDeleteCompetency" OnCommand="lnkDeleteCompetency_Command" AlternateText="Delete File" ImageUrl="~/images/delete.gif" CommandName='<%# DataBinder.Eval(Container, "DataItem.CompetencyId")%>' />

 

</ItemTemplate>

 

</asp:TemplateColumn>

 

</columns>

 

 

<PagerStyle Visible="False" /></asp:datagrid>

 

</td>

 

</tr>

 

<tr>

 

<td><asp:LinkButton runat="server" ID="competencygridexport" Text="export to excel"></asp:LinkButton>

 

 

 

</td></tr></table>

 

 

Sandeep.M

 

</asp:Panel> Thanks,

 
New Post
4/24/2008 7:57 AM
 

Hi All,

I have solved the issue by pasting the following code in the page load function

 

 

If DotNetNuke.Framework.AJAX.IsInstalled Then

 

 

DotNetNuke.Framework.AJAX.RegisterScriptManager()

 

 

DotNetNuke.Framework.AJAX.WrapUpdatePanelControl(Me.pnlCompetencies, True)

DotNetNuke.Framework.AJAX.RegisterPostBackControl(Me.competencygridexport)

End If

pnlCompetencies is my panel and competencygridexport is my exportlink.Now i am able to export data but my paging events are not working now.

Any Help would be greatly appreciated.I have written the paging events as of like in the file manager.

Thanks,

Sandeep.M

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...re:asp.net ajax problem in mymodulere:asp.net ajax problem in mymodule


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out