지난 주에 대리인들과 작업하기 시작했으며 백그라운드에서 gridview async를 업데이트하려고합니다. 모든 잘, 아무런 오류 또는 그런가하지만 난 내 EndInvoke 후 결과를 얻을 간다. 아무도 내가 뭘 잘못하고 있는지 알아? 여기 AsyncCallback이 왜 내 gridview를 업데이트하지 않습니까?
는 코드입니다 :public delegate string WebServiceDelegate(DataKey key);
protected void btnCheckAll_Click(object sender, EventArgs e)
{
foreach (DataKey key in gvTest.DataKeys)
{
WebServiceDelegate wsDelegate = new WebServiceDelegate(GetWebserviceStatus);
wsDelegate.BeginInvoke(key, new AsyncCallback(UpdateWebserviceStatus), wsDelegate);
}
}
public string GetWebserviceStatus(DataKey key)
{
return String.Format("Updated {0}", key.Value);
}
public void UpdateWebserviceStatus(IAsyncResult result)
{
WebServiceDelegate wsDelegate = (WebServiceDelegate)result.AsyncState;
Label lblUpdate = (Label)gvTest.Rows[???].FindControl("lblUpdate");
lblUpdate.Text = wsDelegate.EndInvoke(result);
}
답장을 보내 주셔서 감사합니다. 몇 가지 일을 직접 수행했으며 답변을 읽은 후에 행이 아무 것도 반환하지 않는다는 것이 분명 해졌습니다. 나는 레이블 핸들을 저장하기 위해 객체를 업데이트하는 당신의 제안을 지금 시도 할 것입니다. 편집 : 나는 또한 내가 가지고있는 버전으로 위의 코드를 업데이트했습니다. – Naruji
난 행과 상관 할 단서가 없다 [...], 어쩌면 나는 int와 ++를 추가해야한다. 그러나 그것이 나에게 묻는다면 평범한 추악한 것들이다. – Naruji