ドロップダウンリストを使用して特定のデータソースをアタッチすると、このエラーが発生します。他のすべてのテーブル/データソースで正常に動作します。javascript/jqueryを使用してドロップダウンリストに変更を加えていません(現在を除く他のすべてのデータソースで正常に機能するため)
エラー:
Invalid postback or callback argument. Event validation is
構成で使用するか、ページで <%@ Page EnableEventValidation="true" %> を使用して有効にします。セキュリティ上の目的で、この機能は、ポストバック イベントまたはコールバック イベントへの引数が、それらを最初にレンダリングしたサーバー コントロールから発信されていることを確認します。データが有効で期待される場合は、ClientScriptManager.RegisterForEventValidation メソッドを使用して、検証のためにポストバックまたはコールバック データを登録します。
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以外)にバインドすると、正常に動作します..しかし、このデータソースで実行すると、上記のエラーがスローされます。
私の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>
データを正常に取得してドロップダウンリストに表示しますが、そこからアイテムを選択すると(選択したインデックスが変更されます)、このメッセージが表示されます...
ありがとう