這是錯誤:無效的回發或回調參數
Invalid postback or callback argument. Event validation is enabled using
<pages enableEventValidation="true"/> 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.
這是我在做什麼:
ASPX:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
myUserControl.DataBind();
}
}
用戶控件:
public override void DataBind()
{
ddlContacts.DataSource = SessionHandler.Contacts;
ddlContacts.DataValueField = "Id";
ddlContacts.DataTextField = "Name";
ddlContacts.DataBind();
ddlOrderbillto.DataSource = SessionHandler.Contacts;
ddlOrderbillto.DataValueField = "Id";
ddlOrderbillto.DataTextField = "Name";
ddlOrderbillto.DataBind();
ddlState.DataSource = SessionHandler.FederalStates;
ddlState.DataTextField = "Name";
ddlState.DataValueField = "Id";
ddlState.DataBind();
if (Info.Id > 0)
{
//load info
}
}
正如你所看到的,我有2滴自己的名單,我加載ddlContacts
和ddlOrderbillto
和一切工作就像它應該。只要我突然加入ddlState
,我就會收到上面提到的錯誤。我試過把它放在更新面板裏面,什麼都沒有。如果我評論的ddlState
數據源,數據綁定那麼它的工作原理,但顯然我留下了無狀態:(
請幫助
編輯:我有2名其他下拉列表「ddlCounties」和「ddlCity」的時候頁面數據綁定它們是空白的,但在改變「ddlState」時,它們通過jquery填充,所以從我讀到的是,因爲它們不是最初加載的,那麼這可能是錯誤的?
是啊,你說得對,我不幸不希望出現這種情況,所以我不得不恢復到選擇和hiddenfields :(謝謝儘管 – Andres
@Andres:歡迎.. !!並且樂於幫助:) –