Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi All., Iam having a nested update panel something like this

 <asp:UpdatePanel ID="DetailsUpdatePanel" runat="server" Visible="false" UpdateMode="Conditional" >
<ContentTemplate>
<div><ajaxToolkit:AsyncFileUpload runat="server" ID="BrochureUpload" Width="400px"
        OnClientUploadError="BrochureuploadError"
        OnClientUploadStarted="BrochureStartUpload"
        OnClientUploadComplete="BrochureUploadComplete"
        CompleteBackColor="Lime" UploaderStyle="Modern"
        ErrorBackColor="Red" ClientIDMode="AutoID"
        ThrobberID="Throbber"
        UploadingBackColor="#66CCFF"
            onuploadedcomplete="BrochureUpload_UploadedComplete"/>
            <asp:Label ID="Label1" runat="server" Style="display: none">
 <asp:Image runat="server" ID="Image1" ImageUrl="~/Images/uploading.gif" />
        </asp:Label>
  <asp:Label ID="brochurelblstatus" runat="server" Style="font-family: Arial; font-size: small;"></asp:Label></div>
 <div><asp:UpdatePanel runat="server" ID="child" UpdateMode="Conditional" >
            <ContentTemplate>
            <div>
 <asp:GridView ID=GridView2" runat="server" AllowPaging="true" AutoGenerateColumns="false" CellPadding="0" CellSpacing="1" DataKeyNames="ArticleId">
    <Columns>
   <asp:BoundField DataField="ArticleId" HeaderText="ArticleId" ReadOnly="True" HeaderStyle-CssClass="td1" />
   <asp:BoundField DataField="FileName" HeaderText="FileName" ReadOnly="True" HeaderStyle-CssClass="td2" />
   <asp:TemplateField HeaderText="BrochureUrl">
   <ItemTemplate>
   <asp:HyperLink ID="lnkEPhoto" runat="server" BorderWidth="2px" NavigateUrl='<%# GetUrl(Eval("ArticleId"),Eval("FileName")) %>'
                Target="_blank"></asp:HyperLink>
      </ItemTemplate>
   </asp:TemplateField>
   <asp:TemplateField>
  <ItemTemplate>
   <asp:LinkButton ID="btnRemove" runat="server" text="Delete" CommandName="Delete" CausesValidation="False" OnClientClick="DeleteOrNo()">
   </asp:LinkButton>
     </ItemTemplate>
   </asp:TemplateField>
     </Columns>
    </asp:GridView>
       </div>

            </ContentTemplate>

            </asp:UpdatePanel></div>
</ContentTemplate>
</updatePanel>

CodeBehind:
 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();

        }
    }

When I upload the file , I want the giedview which is in the child updatepanel to be updated .But it doesnt work Any ideas?????

thanks in advance
Posted
Updated 13-May-11 5:02am
v2
Comments
BobJanova 13-May-11 11:02am    
Edit to fix pre tags.

1 solution

Set the UpdateMode of the child panel to "Conditional" (you have already done this) and add AsyncPostBackTriggers to the child update panel. This section would contain the elements from the parent update panel, that should cause the child update panel to be updated.

PS - I haven't tried this. But I guess this should work. Sorry if it wasn't helpful. But your solution to this problem would be along these lines.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900