嵌套更新面板问题

我有一个这样的嵌套更新面板

  
<asp:HyperLink ID="lnkEPhoto" runat="server" BorderWidth="2px" NavigateUrl='' Target="_blank">

代码隐藏:

 protected void BrochureUpload_UploadedComplete(object sender, AsyncFileUploadEventArgs e) { if(BrochureUpload.HasFile) { if(BrochureUpload.PostedFile.ContentLength<=3670016 ) { var brochurePath = MapPath("~/") + Path.GetFileName(e.filename); BrochureUpload.SaveAs(brochurePath); using (var dataContext = new NewsStandAloneDataContext(Config.StandaloneNewsConnectionString)) { var brochure = new xxx { Id = Convert.ToInt32(GridView1.SelectedValue), FileName = Path.GetFileName(e.filename), RecordCreated = DateTime.Now }; dataContext.xxx.InsertOnSubmit(brochure); dataContext.SubmitChanges(); } bindGridView();//I have code to bind gridview Child.Update(); } } } protected void bindBrochureGridView() { using (var dataContext = new NewsStandAloneDataContext(Config.StandaloneNewsConnectionString)) { var brochureList = (from brochure in dataContext.xxx where brochure.ArticleId == Convert.ToInt32(GridView2.SelectedValue) select new ArcticleBrochure { ArticleId = brochure.ArticleId.ToString(), FileName = brochure.FileName }).ToList(); GridView1.DataSource = brochureList; GridView1.DataBind(); } } 

当我上传文件时,我希望更新子更新面板中的giedview。但它不起作用任何想法?????

提前致谢

调用child.Update();BrochureUpload_UploadedComplete事件中。

  protected void BrochureUpload_UploadedComplete(object sender, AsyncFileUploadEventArgs e) { .................... .................... bindGridView();//I have code to bind gridview child.Update(); } 

文件上传完成后,调用UpdatePanel Child.Update()方法,其中包含gridview。 您需要这样做,因为您设置UpdateMode="Conditional"在这种情况下您必须在代码中手动更新它。

您的更新面板中的ChildrenAsTriggers="True"