Here is the code.
This is the declaration of the delegate and the event varialble.
public delegate void onNestedGridViewDeslectEvent();
[Category("NestedGridViewAction")]
public event onNestedGridViewDeslectEvent deselect;
Update panel and its contents
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" >
<ContentTemplate>
<cc1:nestedgridview id="NestedGridView1" runat="server" cellpadding="4"
childpagesize="5" childpaging="False" collapsetext="~/Configuration/Images/collapse.gif"
expandcolumnwidth="18px" expandtext="~/Configuration/Images/expand.gif" forecolor="Black" multiselection="True" parentchildcongruent="True"
relationname="ParentChildEntry" width="100%" DataSourceID="ods" DataKeyNames="pom_entry_pk" OnSelectedIndexChanged="NestedGridView1_SelectedIndexChanged" setChildDataKeyNames="pom_entry_pk,prnt_pom_entry_pk" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellSpacing="2" Ondeselect="NestedGridView1_deselect" OnmultiSelectionStatusChanged="NestedGridView1_multiSelectionStatusChanged" style="display:none">
<FooterStyle BackColor="#CCCCCC"></FooterStyle>
<HeaderStyle BackColor="Black" ForeColor="White" Font-Bold="True"></HeaderStyle>
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left"></PagerStyle>
<SelectedRowStyle BackColor="#000099" ForeColor="White" Font-Bold="True"></SelectedRowStyle>
<RowStyle BackColor="White"></RowStyle>
</cc1:nestedgridview>
<asp:ObjectDataSource TypeName="Siemens.MES.CAB.TPLPOH.Domain.Interfaces.IBreadHierarchicalEntries" SelectMethod="getEntries" OnObjectCreating="ods_ObjectCreating" ID="ods" runat="server">
<SelectParameters>
<asp:SessionParameter DefaultValue="-1" SessionField="orderPK" Name="orderPk" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:Panel ID="Panel1" runat="server" Width="100%">
<asp:Button ID="btnDownload" runat="server" CssClass="button" OnClick="btnDownload_Click"
Text="Download" Width="133px" />
<asp:Button ID="btnProperties" runat="server" CssClass="button" OnClick="btnProperties_Click"
Text="Properties" Width="133px" />
<asp:Button ID="btnEdit" runat="server" CssClass="button" OnClick="btnEdit_Click"
Text="Edit" Width="133px" />
<asp:Button ID="btnSplit" runat="server" CssClass="button" OnClick="btnSplit_Click"
Text="Split" Width="133px" />
<asp:Button ID="btnChangeStatus" runat="server" CssClass="button" OnClick="btnChangeStatus_Click"
Text="ChangeStatus" Width="133px" />
<asp:HyperLink ID="hypOpenPopup" runat="server" Target="_blank">HyperLink</asp:HyperLink></asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="NestedGridViewSingleSelection1$NestedGridView1" EventName="SelectedIndexChanged"/>
<asp:AsyncPostBackTrigger ControlID="NestedGridViewSingleSelection1$NestedGridView1" EventName="deselect"/>
<asp:AsyncPostBackTrigger ControlID="NestedGridViewSingleSelection1$NestedGridView1" EventName="childGridView_SelectedIndexChanging"/>
</Triggers>
</asp:UpdatePanel>
Function Declared In the code to link the deselect event.
protected void NestedGridView1_deselect()
{
Session.Add("orderPK", "-1");
((ObjectDataSource)this.Page.FindControl("NestedGridViewMultiSelection1$ods")).Select();
((NestedGridView.NestedGridView)this.Page.FindControl("NestedGridViewMultiSelection1$NestedGridView1")).Style.Add("display","none");
}