2011-08-04 9 views
1

dropdownlist를 사용하여 특정 데이터 소스를 첨부 할 때이 오류가 발생합니다. 다른 모든 테이블/데이터 소스는 잘 작동합니다. 나는 (그것의 현재를 제외한 다른 모든 데이터 소스와 함께 잘 작동으로) 자바 스크립트/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 파일에서 값을 얻을 :

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

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; 


} 
내가 내 DropDownList로와 결합하고 어떻게 0

내가 언제 다른 데이터 소스 (비 - 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> 

는 성공적으로 다음이 메시지를 보여줍니다 데이터를 가져 오는 중 오류와 드롭 다운리스트에 표시하지만 난 그것에서 어떤 항목을 선택하면 (선택된 인덱스가 변경) ...

감사 :

내 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() 
          }; 

나의 최종 결론은이 빈 공간의 문제 나해야 값으로 ...

1

드롭 다운리스트를 포함한 입력 요소에 '<'또는 '>'문자가 포함되어 있으면이 오류가 발생합니다.

이러한 값이있는 경우 인코딩을 시도 했습니까? , 난 그냥 사용하는 트림() 및 LINQ를 사용하는 동안

관련 문제