I have a fairly straight forward Gridview which pulls in a set of Umbraco nodes. I am binding it on page load.
My issue comes up on the RowCommand to remove a program(node). The code to remove executes fine. The program(node) gets removed from Umbraco. Yet, no matter what I try, I can't get the GridView to refresh properly. The removed entry is still available. Only a hard browser refresh clears it.
A databind after the processing was not cutting it. A redirect back to the page was not either. I've tried a permanentRedirect, which works sometimes, but not all.
<asp:GridView ID="gvPrograms" runat="server"CssClass="styledTable"AllowPaging="true"PageSize="5"AutoGenerateColumns="false"OnPageIndexChanging="gvPrograms_PageIndexChanging"
onrowcommand="gvPrograms_RowCommand"
onrowdatabound="gvPrograms_RowDataBound"><rowstyle backcolor="White"
forecolor="#006296"
font-italic="false"/><alternatingrowstyle backcolor="#dbeef9"
forecolor="#006296"
font-italic="false"/><Columns><asp:BoundFieldDataField="Name"HeaderText="Program Name"/><asp:TemplateFieldHeaderText="Date"><ItemTemplate><asp:Label ID="lblProgramDate" runat="server"></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateField><ItemTemplate><asp:LinkButton ID="lnkEdit" runat="server"Text="Edit"></asp:LinkButton></ItemTemplate></asp:TemplateField><asp:TemplateField><ItemTemplate><asp:LinkButton ID="lnkRemove" runat="server"Text="Remove"></asp:LinkButton></ItemTemplate></asp:TemplateField></Columns></asp:GridView>protectedvoid gvPrograms_RowCommand(object sender,GridViewCommandEventArgs e){if(e.CommandName=="Edit Program"){PopulateProgram(e.CommandArgument.ToString());
displayPanels(pnlAddProgram);
hdrEdit.InnerText="Edit Program";}elseif(e.CommandName=="Remove Program"){int id =Int32.Parse(e.CommandArgument.ToString());//remove node from umbracoDocument d =newDocument(id);//umbraco.library.UnPublishSingleNode(id);
d.delete();
umbraco.library.UpdateDocumentCache(d.Id);
umbraco.content.Instance.RefreshContentFromDatabaseAsync();
umbraco.library.RefreshContent();
lblMsg.Text="The program has been successfully removed!";
lblMsg.Visible=true;Response.RedirectPermanent("/chapter-tools/chapter-management-center/chapter-content-admin/programs-list.aspx");//BindData(programsNodeID);}}
Gridview refresh issues with Umbraco nodes
I have a fairly straight forward Gridview which pulls in a set of Umbraco nodes. I am binding it on page load.
My issue comes up on the RowCommand to remove a program(node). The code to remove executes fine. The program(node) gets removed from Umbraco. Yet, no matter what I try, I can't get the GridView to refresh properly. The removed entry is still available. Only a hard browser refresh clears it.
A databind after the processing was not cutting it. A redirect back to the page was not either. I've tried a permanentRedirect, which works sometimes, but not all.
is working on a reply...