2012-03-14 30 views
1

我在頁面中使用asp:中繼器,它有OnItemCommand。但在IE7(兼容模式),當我在轉發點擊按鈕,它不工作,說此錯誤:asp:轉發器項目命令不觸發在IE7(兼容模式)

Invalid postback or callback argument. Event validation is enabled using in configuration or 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.

這是代碼:

<asp:Repeater ID="rptExternalLinks" runat="server" OnItemCommand="rptExternalLinks_ItemCommand1"> 
    <ItemTemplate> 
     <asp:Button ID="lbtnDelet" CssClass="simaUI-icon simaUI-icon-closethick" runat="server" CommandName="DeleteItem" /> 
    </ItemTemplate> 
</asp:Repeater> 

它在其他瀏覽器像IE9,FF,Chrome和...但它說IE兼容模式的錯誤。

回答

1

這真是奇怪的行爲。不幸的是,我無法重現給定語法的錯誤。

如果您在每次回發中保持重新綁定重複器,您肯定會收到錯誤,因此您必須確保綁定僅在頁面未回傳時才能綁定。

if (!Page.IsPostBack) 
{ 
    //your code 
} 

此外,你是否使用任何元標記進行內容緩存(客戶端)?我也會清除瀏覽器的緩存。

如果您有任何更多的具體細節,請讓我知道。

希望它有幫助。

+0

感謝塞巴斯蒂安,這是因爲回發,我在頁面加載測試頁面創建一個列表,然後設置中繼器的數據源到該列表,我把創建列表中的「」if(!Page.IsPostBack ){}「」,它的工作原理。 但鋼它沒有解決,爲什麼它在其他瀏覽器工作... – Emech 2012-03-14 16:35:05

+0

這很奇怪,這是我必須找出。 – 2012-03-14 16:47:41