Sys.WebForms.PageRequestManagerParserErrorException
本文关键字:PageRequestManagerParserErrorException WebForms Sys | 更新日期: 2023-09-27 18:02:49
test. asx .cs文件(Web User Control)
protected void lnkOrderDetail_Command(object sender, CommandEventArgs e)
{
Telerik.Web.UI.GridDataItem item = gvAllDocuments.Items[int.Parse(e.CommandArgument.ToString())];
string FileName = item["documentFileName"].Text;
string PathString = @"C:'Documents'";
string SubPath = PathString + Utils.GetUserName() + "''" + FileName;
FileInfo FileInfo1 = new FileInfo(SubPath);
Response.ClearContent();
Response.AppendHeader("Content-Disposition", "attachment; filename=" + FileName + "");
Response.ContentType = "text/HTML";
Response.AddHeader("Content-Length", FileInfo1.Length.ToString());
Response.TransmitFile(SubPath);
Response.End();
}
<asp:UpdatePanel ID="UpdatePanelDocuments" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="ViewDocumentsButton" runat="server" Text="View/Upload Documents" OnClick="ViewDocumentsButton_Click" />
<asp:PlaceHolder ID="UploadPlaceHolder" runat="server" Visible="false">
<hr />
<br />
<asp:Label Text="Document Type :" runat="server" ID="DocuemntLabel"></asp:Label>
<br />
<asp:Label Text="File :" runat="server" ID="FileLabel"></asp:Label>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:RegularExpressionValidator ID="uplValidator" runat="server" ControlToValidate="FileUpload1"
ErrorMessage=".png, jpg & pdf formats are allowed"
ValidationExpression="(.+'.([Pp][Nn][Gg])|.+'.([Jj][Pp][Gg])|.+'.([Pp][Dd][Ff]))"></asp:RegularExpressionValidator>
<asp:CustomValidator ID="customValidatorUpload" runat="server" ErrorMessage="" ControlToValidate="FileUpload1" ClientValidationFunction="setUploadButtonState();" />
<br />
<asp:Button ID="btnUpload" runat="server" Text="Upload file" OnClick="Upload" Enabled="false" />
</asp:Label>
<br />
<br />
<telerik:RadGrid ID="gvAllDocuments" runat="server" AutoGenerateColumns="false"
AllowFilteringByColumn="true" RegisterWithScriptManager="true"
AllowPaging="true" PageSize="10">
<GroupingSettings CaseSensitive="false" />
<MasterTableView CommandItemSettings-ShowExportToExcelButton="false" CommandItemSettings-ShowRefreshButton="false" CommandItemSettings-ShowAddNewRecordButton="false" CommandItemDisplay="Top">
<Columns>
<telerik:GridBoundColumn DataField="fileType" HeaderText="File Type" Visible="false"></telerik:GridBoundColumn>
<telerik:GridTemplateColumn>
<ItemTemplate>
<asp:Button ID="lnkOrderDetail" runat="server" Text="View" CommandArgument='<%#Container.ItemIndex%>' OnCommand="lnkOrderDetail_Command"></asp:Button>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Resizing AllowResizeToFit="true" />
</ClientSettings>
</telerik:RadGrid>
</asp:PlaceHolder>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnUpload" />
</Triggers>
</asp:UpdatePanel>
TransmitFile没有做任何事情?!我在web-console
上得到以下错误错误:sys . webforms . pagerequestmanagerparsererrorreexception: The无法解析从服务器收到的消息。常见的原因的方法修改响应时发生此错误response . write()、响应过滤器、HttpModules或服务器跟踪启用。
详细信息:解析' ` ` ` ` ` ` N'Exif
这个工作对我来说很好,因为按钮是包含Telerik grid
我添加了以下内容:
<Triggers>
<asp:PostBackTrigger ControlID="gvAllDocuments" />
</Triggers>