2011-03-20 62 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

相關問題