2011-08-04 13 views
1

特定のデータソースをドロップダウンリストに添付すると、このエラーが発生します。その他のテーブル/データソースはすべて正常に動作します。 は、私が(そのは、現在を除く他のすべてのデータソースに細かい作業など)のjavascript/jqueryのを使用して、ドロップダウンリストの変更は致しておりませんポストバックまたはコールバックの引数が無効です

エラー:

Invalid postback or callback argument. Event validation is 

enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

私の機能は、XMLファイルから値を取得する:

public List<ProductReviewmaster> ConvertRssXDocToReviews(XDocument xdoc) 
{ 
    List<ProductReviewmaster> nl = new List<ProductReviewmaster>(); 

    if (xdoc != null) 
    { 
     var res = from rs in xdoc.Descendants("item") 
        select new ProductReviewmaster() 
        { 
         Title = rs.Element("title").Value, 
         ShortHeadLine = rs.Element("shortheadline").Value, 
         Link = rs.Element("link").Value, 
         Reviewid = rs.Element("guid").Value , 
         //Pubdate = Convert.ToDateTime(rs.Element("pubdate").Value), 
         Image = rs.Element("storyimage").Value, 
         Dateline = rs.Element("dateline").Value, 
         Excerpt = rs.Element("excerpt").Value, 
         Tags = rs.Element("tags").Value, 
         ProductId = rs.Attribute("productid").Value.ToInt64() 
        }; 
     foreach (var item in res) 
     { 
      nl.Add(item); 

     } 
    } 
    return nl; 


} 

これは私が私のドロップダウンリストでそれを結合しています方法です:

ddlReview.DataSource = prmf.GetReviewByCategoryKey(categoryid); 
       ddlReview.DataValueField = "Reviewid"; 
       ddlReview.DataTextField = "Title"; 
       ddlReview.DataBind(); 
       ddlReview.Items.Insert(0, new ListItem("---Select---")); 

私は他のデータソース(非XML)と同じドロップダウンリストをバインドするときにはうまく動作します。しかし、このデータソースでそれを実行しているときに、上記のエラーが発生します。

<rss version="2.0"> 
    <channel> 
    <title> 

     </title> 
    <link> 

     </link> 
    <language>en</language> 
    <lastBuildDate> 
      August 3, 2011 3:57 PM 
     </lastBuildDate> 
    <image> 
     <url></url> 
     <link> 
      </link> 
    </image> 
    <items> 
     <item productid=""> 
     <title><![CDATA[This is new test review]]></title> 
     <shortheadline><![CDATA[]]></shortheadline> 
     <link> 

        </link> 
     <permaLink> 
      <web> 

         </web> 
     </permaLink> 
     <guid isPermaLink="false"> 
         29527 
        </guid> 
     <pubDate> 
         August 2, 2011 1:56 PM 
        </pubDate> 
     <MobileText></MobileText> 
     <storyimage><![CDATA[ges/apple-appstore.jpg]]></storyimage> 
     <categories><![CDATA[mobile]]></categories> 
     <dateline><![CDATA[]]></dateline> 
     <excerpt><![CDATA[isational structure for its operations in India and South Asia with effetransformational business...]]></excerpt> 
     <tags><![CDATA[mobile, phone]]></tags> 
     <contenttype><![CDATA[Review]]></contenttype> 
     </item> 
    </items> 
    <description></description> 
    </channel> 
</rss> 

その成功し、それは、このメッセージを表示し、データをretrivingし、ドロップダウンリストに表示さしかし、私はそれから任意の項目を選択すると、(選択されたインデックスが変更された)...

ありがとう:

私のXMLは次のようです

答えて

1

最終的に私はので、私の最終的な結論は私が空白の問題が必要です:)

var res = from rs in xdoc.Descendants("item") 
          select new ProductReviewmaster() 
          { 
           Title = rs.Element("title").Value.Trim(), 
           ShortHeadLine = rs.Element("shortheadline").Value.Trim(), 
           Link = rs.Element("link").Value.Trim(), 
           Reviewid = rs.Element("guid").Value.Trim() , 
           //Pubdate = Convert.ToDateTime(rs.Element("pubdate").Value), 
           Image = rs.Element("storyimage").Value.Trim(), 
           Dateline = rs.Element("dateline").Value.Trim(), 
           Excerpt = rs.Element("excerpt").Value.Trim(), 
           Tags = rs.Element("tags").Value.Trim(), 
           ProductId = rs.Attribute("productid").Value.ToInt64() 
          }; 

... LINQ、私だけで使用トリムを(使用している間 ...問題を解決)し、その行われ値付き...

1

ドロップダウンリストを含む入力要素に「<」または「>」のいずれかの文字が含まれていると、このエラーは通常発生します。

これらの値が存在する場合はエンコードしてみましたか?

関連する問題