2011-03-20 70 views
0

我收到以下错误使用更新面板与gridview。如何从数据库获取BLOB值并将其存储在自定义对象中的字符串中?

Microsoft JScript运行时错误:Sys.WebForms.PageRequestManagerParserErrorException:无法解析从服务器收到的消息。此错误的常见原因是,通过调用Response.Write(),响应筛选器,HttpModules或服务器跟踪已启用来修改响应时。

我已经看过所有的“修复”,并没有人似乎工作。它在页面加载时工作得很好,但是当我点击我的异步按钮时,网格进程的一行(我可以在javascript调试中查看),但是在处理完第一行之后,我在此行发生上述错误。

try { _this._webRequest.completed(Sys.EventArgs.Empty); } 如果(_this._xmlHttpRequest!= null){ _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod; _this._xmlHttpRequest = null; }}

这里是我的GridView

<asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" /> 
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
    <ContentTemplate> 
     <table border="0" cellpadding="2" cellspacing="0" width="100%" id="Table3"> 
      <tr> 
       <td width="100%"> 
        <table border="0" cellpadding="0" width="100%" id="Table4"> 
         <tr> 
          <td> 
           <span style="font-size: x-large;">Results</span> 
          </td> 
         </tr> 
         <tr> 
          <td style="text-align: left;"> 
           <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label> 
           <asp:Label ID="lblCount" runat="server" ForeColor="Black"></asp:Label> 
          </td> 
          <td style="text-align: right;"> 
           <asp:Label ID="lblCount2" runat="server" ForeColor="Black"></asp:Label> 
          </td> 
         </tr> 
         <tr> 
          <td colspan="2"> 
           <asp:GridView Width="100%" ID="resultsGrid" AutoGenerateColumns="false" runat="server" 
            AllowPaging="true" AllowSorting="true" PageSize="20" OnPageIndexChanging="gridView_PageIndexChanging" 
            OnSorting="gridView_Sorting" PagerSettings-Position="TopAndBottom" PagerStyle-HorizontalAlign="Center"> 
            <Columns> 
             <asp:TemplateField HeaderStyle-Width="2%" ControlStyle-Width="100%"> 
              <ItemTemplate> 
               <%# Container.DataItemIndex + 1 + "." %> 
              </ItemTemplate> 
             </asp:TemplateField> 
             <asp:TemplateField Visible="false" SortExpression="record_id"> 
              <ItemTemplate> 
               <asp:Label ID="lblRecordID" runat="server" Text='<%# Eval("RecordID") %>' Visible="false"></asp:Label> 
              </ItemTemplate> 
             </asp:TemplateField> 
             <asp:TemplateField HeaderStyle-Width="7%" ControlStyle-Width="100%" HeaderText="Note Type" 
              SortExpression="business_content_type_cd"> 
              <ItemTemplate> 
               <asp:Label ID="lblNoteType" runat="server" Text='<%# Eval("NoteType") %>'></asp:Label> 
              </ItemTemplate> 
             </asp:TemplateField> 
             <asp:TemplateField HeaderStyle-Width="10%" ControlStyle-Width="100%" HeaderText="Author" 
              SortExpression="author_user_name"> 
              <ItemTemplate> 
               <asp:Label ID="lblAuthor" runat="server" Text='<%# Eval("Author") %>'></asp:Label> 
              </ItemTemplate> 
             </asp:TemplateField> 
             <asp:TemplateField HeaderStyle-Width="7%" ControlStyle-Width="100%" HeaderText="Date" 
              SortExpression="content_dttm"> 
              <ItemTemplate> 
               <asp:Label ID="lblDate" runat="server" Text='<%# Eval("Date") %>'></asp:Label> 
              </ItemTemplate> 
             </asp:TemplateField> 
             <asp:TemplateField HeaderStyle-Width="60%" ControlStyle-Width="100%"> 
              <ItemTemplate> 
               <asp:Label ID="lblData" runat="server" Text='<%# Eval("NoteContent") %>'></asp:Label> 
               <asp:HyperLink ID="linkMore" runat="server" /> 
              </ItemTemplate> 
             </asp:TemplateField> 
             <asp:TemplateField SortExpression="size" Visible="false"> 
              <ItemTemplate> 
               <asp:Label ID="lblSize" runat="server" Text='<%# Eval("Size") %>' Visible="false"></asp:Label> 
              </ItemTemplate> 
             </asp:TemplateField> 
            </Columns> 
           </asp:GridView> 
          </td> 
         </tr> 
         <tr> 
          <td style="text-align: left;"> 
           <asp:Label ID="lblCount3" runat="server" ForeColor="Black"></asp:Label> 
          </td> 
          <td style="text-align: right;"> 
           <asp:Label ID="lblCount4" runat="server" ForeColor="Black"></asp:Label> 
          </td> 
         </tr> 
        </table> 
       </td> 
      </tr> 
     </table> 
    </ContentTemplate> 
    <Triggers> 
     <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" /> 
    </Triggers> 
</asp:UpdatePanel> 

我在这里完全难倒,任何帮助将是巨大的。

这里是萤火

我的Ajax响应
14008|updatePanel|ctl00_ContentPlaceHolder_UpdatePanel1| 
     <table border="0" cellpadding="2" cellspacing="0" width="100%" id="Table3"> 
      <tr> 
       <td width="100%"> 
        <table border="0" cellpadding="0" width="100%" id="Table4"> 
         <tr> 
          <td> 
           <span style="font-size: x-large;">Results</span> 
          </td> 
         </tr> 
         <tr> 
          <td style="text-align: left;"> 
           <span id="ctl00_ContentPlaceHolder_lblError" style="color:Red;"></span> 
           <span id="ctl00_ContentPlaceHolder_lblCount" style="color:Black;">5 found</span> 
          </td> 
          <td style="text-align: right;"> 
           <span id="ctl00_ContentPlaceHolder_lblCount2" style="color:Black;">1 to 5 of 5</span> 
          </td> 
         </tr> 
         <tr> 
          <td colspan="2"> 
           <div> 
<table cellspacing="0" rules="all" border="1" id="ctl00_ContentPlaceHolder_resultsGrid" style="width:100%;border-collapse:collapse;"> 
    <tr> 
     <th scope="col" style="width:2%;">&nbsp;</th><th scope="col" style="width:7%;"><a href="javascript:__doPostBack('ctl00$ContentPlaceHolder$resultsGrid','Sort$business_content_type_cd')">Note Type</a></th><th scope="col" style="width:10%;"><a href="javascript:__doPostBack('ctl00$ContentPlaceHolder$resultsGrid','Sort$author_user_name')">Author</a></th><th scope="col" style="width:7%;"><a href="javascript:__doPostBack('ctl00$ContentPlaceHolder$resultsGrid','Sort$content_dttm')">Date</a></th><th scope="col" style="width:60%;">&nbsp;</th> 
    </tr><tr> 
     <td> 
               1. 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl03_lblNoteType" style="display:inline-block;width:100%;">General</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl03_lblAuthor" style="display:inline-block;width:100%;">LISA WHIPKEY</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl03_lblDate" style="display:inline-block;width:100%;">3/17/2011 4:08:15 PM</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl03_lblData" style="display:inline-block;width:100%;">HIS ROAD WAS CONTROLLED BY A STOP SIGN. HE NEEDED TO MAKE A LEFT ON TO PINEAND THEN MAKE A LEFT AGAIN QUIKELY INTO A PARKING LOT TO THE LEFT.   HE LOOKED LEFT AND THE INSURED SAW A CAR THAT WAS COMING AT HIM. HE WAS WAITING FOR THE CAR TO PASS BUT THE CAR THAT WAS COMING AT HIM TURNED INTO THE PARKING LOT THAT HE NEEDED TO TURN INTO. THE INSURED WAS AT THE STOP SIGN FOR APPROX 20 TO 30 SECONDS. THE LIGHTS WERE GLARINIG ON THE ROAD.��������������</span> 
               <a id="ctl00_ContentPlaceHolder_resultsGrid_ctl03_linkMore" style="display:inline-block;width:100%;"></a> 
              </td> 
    </tr><tr> 
     <td> 
               2. 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl04_lblNoteType" style="display:inline-block;width:100%;">General</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl04_lblAuthor" style="display:inline-block;width:100%;">LISA WHIPKEY</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl04_lblDate" style="display:inline-block;width:100%;">3/17/2011 4:07:41 PM</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl04_lblData" style="display:inline-block;width:100%;">CALLED THE INSURED MIKE CHALLEEN AT 406-529-5534 LVM CALLED THE CELL OF INSD MIIKE CHALLEEN AT 406-529-5534 CONFIRMED R/S FROM THE INSURED.                     THE INSD DRIVING A FRIENDS VEHICLE. THE INSD WAS STAYING IN MISSOULA FOR ACOUPLE OF DAYS FOR WORK. HE MET MIKE BROWN FOR DINNER AND INSD MIKE HALLEENJUST PURHCES A NEW 2001 CAMARO SS/SP VIN - 2G1FT1EW0A9123754, RED IN COLORMIKE BROWN WAS INTERESTED IN PURCHASING ONE AND WANTED TO DRIVE IT FOR THE EVENING. HE AGREED AND SO THE INSURED DROVE MIKE BROWNS VEHICLE WHICH WAS AFORD TRUCK DESIEL 4 DR. TWO TONE PU LONG BED. MIKE BROWN DROVE HIS VEHICLE 2010 CAMARO. SO IN THE MORNING GOING TO WORK AT APPROX 7:30 AM THIS MORNING THE INSURED WORKED OUT AHEAD A SCHEDULE FROM THE HOTEL DECIDED TO GO IN EARLY.                                    TRAVELING DOWN PATTEE N/B</span> 
               <a id="ctl00_ContentPlaceHolder_resultsGrid_ctl04_linkMore" href="logNoteDetail.aspx?noteID=0" target="_blank" style="display:inline-block;width:100%;">more</a> 
              </td> 
    </tr><tr> 
     <td> 
               3. 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl05_lblNoteType" style="display:inline-block;width:100%;">General</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl05_lblAuthor" style="display:inline-block;width:100%;">LISA WHIPKEY</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl05_lblDate" style="display:inline-block;width:100%;">3/17/2011 3:58:44 PM</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl05_lblData" style="display:inline-block;width:100%;">GENERAL NOTE TESTING 123456GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG G G G G GG G G G G G G G G G GGGGGGGG G G G G G G G G G G G G G G G G GGG G G FGHJH HFDGKL HFG JDFHGKJDHFG DHFG FH KGHDF GHFKJDHGKH DGHFK HF STOPPED THE CK FOR 100,000, SCOTT G. IS NOW DEFENDING THE INSD AND NOT PROTECTING US. I ISSUED OUT THE PAYMENT AND THEN HE HAD THE CK. NOW REVERSED AND WILL NOT RELEASE THE FUNDS TO P/C AND WAS HOLDING FOR AN EXCHANGE OF PAYMENT.                                    BOHXXX, SIMPXXX AND TRAXXXL PC            283 WEST FRONT STREET, SUITE 201           MISSOULA, MONTANA 59802 (MISSOULA CO.)          PHN: 406-532-7800               HTTP://WWW.BSTLAWFIRM.COM                   </span> 
               <a id="ctl00_ContentPlaceHolder_resultsGrid_ctl05_linkMore" href="logNoteDetail.aspx?noteID=0" target="_blank" style="display:inline-block;width:100%;">more</a> 
              </td> 
    </tr><tr> 
     <td> 
               4. 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl06_lblNoteType" style="display:inline-block;width:100%;">General</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl06_lblAuthor" style="display:inline-block;width:100%;">LISA WHIPKEY</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl06_lblDate" style="display:inline-block;width:100%;">3/10/2011 3:55:25 PM</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl06_lblData" style="display:inline-block;width:100%;">PLAN OF ACTION                IUY                  UYUY KJHKJ                 HKJH                  LKJHKJLH                 JKHKJH                  JKH                  KJHJ                  KH                   JKH                  LJ                   HJK                  HLJ                  HLHJ      </span> 
               <a id="ctl00_ContentPlaceHolder_resultsGrid_ctl06_linkMore" href="logNoteDetail.aspx?noteID=0" target="_blank" style="display:inline-block;width:100%;">more</a> 
              </td> 
    </tr><tr> 
     <td> 
               5. 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl07_lblNoteType" style="display:inline-block;width:100%;">General</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl07_lblAuthor" style="display:inline-block;width:100%;">LISA WHIPKEY</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl07_lblDate" style="display:inline-block;width:100%;">3/10/2011 3:53:57 PM</span> 
              </td><td> 
               <span id="ctl00_ContentPlaceHolder_resultsGrid_ctl07_lblData" style="display:inline-block;width:100%;">DFSHK                  HKJH                  KJHK HKJ                 OU OI                  UOIU                  U OU O                  UY                   UY                   Y                   Y                   OIJ                  J                   N                   L      </span> 
               <a id="ctl00_ContentPlaceHolder_resultsGrid_ctl07_linkMore" href="logNoteDetail.aspx?noteID=0" target="_blank" style="display:inline-block;width:100%;">more</a> 
              </td> 
    </tr> 
</table> 

5发现 1至5

我在这段代码中做的是从数据库中转换一个BLOB值并将其存储在一个自定义对象中的字符串中。似乎发生的事情是,在字符串的末尾放置了奇怪的字符。下面是我在做什么,以数据

 byteBLOBData = (Byte[])(row[3]); 
         row["data"] = System.Text.Encoding.UTF8.GetString(byteBLOBData); 

回答

0

一个调试这些问题的最佳方法是检查在Firebug的AJAX响应,并寻找不属于流浪标记转化。如果您使用该AJAX响应的复制/粘贴来更新您的问题,我可以告诉您哪个部分不应该在那里。然后,你知道在你的服务器端代码中寻找什么。

+0

发布了更多问题,如果你可以看戴夫,谢谢! – 2011-03-21 23:53:39

相关问题