This is a migrated thread and some comments may be shown as answers.

Collapse NestedViewTemplate

1 Answer 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jignesh
Top achievements
Rank 1
Jignesh asked on 12 Nov 2013, 11:24 PM
I have the code mentioned below:
When I try to collapse or close the opened NesteViewTemplate,it works when the CommandName is cancel and does not work when the CommandName is Save.
What could be reason behind this behaviour?
I need to close/collapse the NestedViewTemplate after saving the data.
What is worng with the code?

Below are the linkbuttons which will fire the event.
<asp:LinkButton ID="lnkBtnSave" runat="server" Text="Save" CommandName="Save"/>

<asp:LinkButton ID="lnkBtnCancel" runat="server" Text="Cancel" CommandName="Cancel"></asp:LinkButton>

if (e.CommandName == "Save")
{
               e.Item.Expanded = false;
}
else if (e.CommandName == RadGrid.CancelCommandName)
{
e.Item.Expanded = false;
}

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 Nov 2013, 04:28 AM
Hi Jignesh,

Some command names are predefined in RadGrid and the control will respond to them automatically like CancelCommandName, other Commands are also identified by the ItemCommand, but we have to write code to handle them.
Try the following code snippet to collapse grid on Save.

C#:
if (e.CommandName == "Save")
  {
    e.Item.Expanded = false;
    RadGrid1.Rebind();
  }
else if (e.CommandName == RadGrid.CancelCommandName)
  {
    e.Item.Expanded = false;
  }

Thanks,
Princy
Tags
Grid
Asked by
Jignesh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or