私はASP.NET Ajax Control Toolkit、GridView、およびAsyncFileUploadについて話しています。私はAjaxアップデートパネルのgridViewを使って新しいデータをバインドする必要があります
私は、UpdatePanelにGridView、AsyncFileUploadが含まれています。
gridViewは、asyncFileUploadによってアップロードされたfileNamesを表示します。
ファイルのアップロードが完了すると、グリッドビューは更新するまで新しいデータをバインドしません。
私は試しました:onUploadCompletedイベントでgridView.DataBind()が失敗しました。
私は不思議です!私は新しいデータを見るためにラインがajaxの中でポストバックをしたい!
ポイントは何ですか?
編集:(コード)
protected void btnUploadReport(object sender, EventArgs e)
{
if (fuReports.HasFile)
{
try
{
string newFileName = fuReports.FileName.Insert(fuReports.FileName.Length - 5, DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString());
newFileName = Server.MapPath("~/Files/Reports/TextReports/") + newFileName;
fuReports.SaveAs(newFileName);
System.Collections.Specialized.ListDictionary item = new System.Collections.Specialized.ListDictionary();
item.Add("project_id", Request.QueryString["pid"]);
item.Add("title", fuReports.FileName);
item.Add("type", "text");
item.Add("url", newFileName);
ldsReports.Insert(item); // lds means LinqDataSource
grdReports.DataBind();
}
catch (Exception ex)
{
Session["Message"] = ex.Message;
Response.Redirect("~/Message.aspx");
}
}
}
おかげ@Aristos、コードがありますここに –
ちょっと@Aristos、私はまだあなたを待っています:) –
@hashem grdReports.DataSource = ldsReports、データバインドの直前。 – Aristos