ラベル outside の投稿を表示しています。 すべての投稿を表示
ラベル outside の投稿を表示しています。 すべての投稿を表示

2012年3月26日月曜日

Response.Write inside Updatepanel Beta 2

Hi,

I have a button inside a updatepanel, when the client click the button he can download a PDF. Everything works perfectly outside the update panel but not inside it. I got the next error message:

Sys.Webforms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error is when the response is modified by calls to Response.Write...

I really appreciate any help.

Thanks,

Jaime

My code:

PrivateSub ShowPdf(ByVal strPathAsString)

Response.ContentType =

"application/x-download"

Response.AddHeader(

"Content-Disposition","filename=YourPdf.pdf")

Response.WriteFile(strPath)

Response.End()

End Sub

<%@dotnet.itags.org.PageLanguage="VB"AutoEventWireup="false"CodeFile="Resultados.aspx.vb"Inherits="Resultados" %>

<%@dotnet.itags.org.RegisterAssembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

Namespace="Microsoft.Web.UI"TagPrefix="asp" %>

<%

@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="AjaxToolKit" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml">

.............

<

asp:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><tablestyle="width: 840px"><tr><tdstyle="width: 762px; height: 153px;"><AjaxToolKit:RoundedCornersExtenderID="RoundedCornersExtender1"runat="server"TargetControlID="TitlePanel1"Radius="10"></AjaxToolKit:RoundedCornersExtender><AjaxToolKit:CollapsiblePanelExtenderID="CollapsiblePanelExtender1"runat="server"Collapsed="true"SuppressPostBack="false"TargetControlID="ContentPanel1"ExpandControlID="Panel1"CollapseControlID="Panel1"imageControlID="image1"ExpandedImage="~/images/collapse_blue.jpg"CollapsedImage="~/images/expand_blue.jpg"></AjaxToolKit:CollapsiblePanelExtender>............

<

asp:PanelID="ContentPanel1"runat="server"CssClass="collapsePanel"Height="0"Width="728px"><tablestyle="width: 728px"><tr><tdstyle="width: 93px; height: 4px"><asp:ButtonID="Button1A"runat="server"Font-Bold="True"Font-Size="X-Small"ForeColor="Crimson"Text="Get Your PDF"Width="224px"/></td>

Hi,

After a while I have found a workaround for the problem I posted, so I am posting this workaround here in case someone else have the same problem:

Basically I have include a second button (button2) outside the control panel. Once the first button (button1, the one inside the updatepanel) is clicked it fire the next javascript:

<input type="submit" name="Button1" value="Button" onclick="javascript:document.getElementById('button2').click() ;" id="Button1" /><br />

So button1 "clicks" button2 (that is the one outside the updatepanel) and this second button is the one that get the PDF file.

To include the javascript you just need to include the next line (in vb) in the "load" of the page:

button1.Attributes.Add(

"onclick","javascript:document.getElementById('button2').click() ;")

Now i am looking for a way to hidde button2 (notice that in order to click it you can not set visible to false).

Hope this can help someone.

Best,

Jaime

2012年3月24日土曜日

RoundCornersExtender both right corners are outside the bounds of the div

On IE, my panel appears with the corner border missing chunks. Actually, the border runs outside the width of the div because
ASP.NET renders the corner DIVs with a margin-right of 6px through -2px (for a radius of 8). This causes the last two pixels
to not show up.

This renders perfectly under FireFox.

Created a panel with a rounded corner extender on it like this:

 <asp:Panel ID="pnlAddMeToYourBlackBook" runat="server" Width="147px" BackColor="#ebf5ff" Style="margin-top: 2px"> <div style="padding-left: 10px"> <table cellspacing="0" cellpadding="0" width="124px" border="0"> <tr valign="top" align="left"> <td width="26px"> <asp:ImageButton ID="btnImgBlackBook" runat="server" ImageUrl="~/images/SearchResults/graphics/prof_icon_blackbook2.gif" BorderStyle="None" Width="18px" Height="18px" ToolTip="Add this user to your Black Book" ImageAlign="absmiddle"></asp:ImageButton></td> <td> <asp:LinkButton ID="btnBlackBook" runat="server" CssClass="lc_prof_comm_link">Add me to your<br>Black Book</asp:LinkButton></td> </tr> </table> </div> </asp:Panel>

<

cc1:RoundedCornersExtenderID="rcAddMeToYourBlackBook"runat="server"BorderColor="#7eb1e6"Corners="Bottom"Radius="8"TargetControlID="pnlAddMeToYourBlackBook">

</

cc1:RoundedCornersExtender>

Does anyone have a suggestion for why this is rendered this way?

Thanks
Larry

Anyone have a clue on this?

SomthingI failed to mention was that the corners worked perfectly on IE when I was building in a separate project. Then when I incorporated the page into the main website (very large, lots of legacy stuff, css, prototype libs, ajaxpro libs, etc.), the corners started messing up. Does anyone know what could be conflicting with ASP.NET AJAX in a chaotic environment like this?

Thanks,
Larry