This is a migrated thread and some comments may be shown as answers.
remove item from code behind
4 Answers 39 Views
This is a migrated thread and some comments may be shown as answers.
robert
Top achievements
Rank 1
robert asked on 21 Jun 2009, 09:23 AM
Dear Telerik,

I'm trying to remove the item "EmployeeInformation" from the code behind. However I can't get it working.

I have tried (as within the example "add remove items"):
RadPanelItem item = RadPanelBar1.FindItemByValue("EmployeeInformation");
item.Owner.Items.Remove(item);
But this doesn't work.

Could you give me a clue?

The code I'm using:
<telerik:RadPanelBar runat="server" ID="RadPanelBar1" ExpandMode="SingleExpandedItem" Width="800px" onprerender="RadPanelBar1_PreRender" oninit="RadPanelBar1_Init">
    <Items>
      <telerik:RadPanelItem Expanded="True" Text="Step 1: General information" runat="server" Selected="true">
        <Items>
          <telerik:RadPanelItem Value="GeneralInformation" runat="server">
            <ItemTemplate>
              <asp:Button runat="server" ID="nextButton" OnClick="nextButton_Click" Text="Next" ValidationGroup="accountValidation" />
            </ItemTemplate>
          </telerik:RadPanelItem>
        </Items>
      </telerik:RadPanelItem>
      <telerik:RadPanelItem Enabled="True" Text="Step 2: Employee information" runat="server">
        <Items>
          <telerik:RadPanelItem Value="EmployeeInformation" runat="server">
            <ItemTemplate>
            </ItemTemplate>
          </telerik:RadPanelItem>
        </Items>
      </telerik:RadPanelItem>
       <telerik:RadPanelItem Enabled="False" Text="Step 3: Account information" runat="server">
        <Items>
          <telerik:RadPanelItem Value="AccountInformation" runat="server">
            <ItemTemplate>
              <asp:Button runat="server" ID="registerButton" OnClick="registerButton_Click" Text="Register" ValidationGroup="TermsValidation" />
            </ItemTemplate>
          </telerik:RadPanelItem>
        </Items>
      </telerik:RadPanelItem>
    </Items>
    <CollapseAnimation Duration="100" Type="None" />
    <ExpandAnimation Duration="100" Type="None" />
  </telerik:RadPanelBar>

4 Answers, 1 is accepted

Sort by
0
-DJ-
Top achievements
Rank 1
answered on 21 Jun 2009, 02:22 PM
Hi robert,

Your code works at my end.
What event are you using to remove the item?

Regards,
-DJ-
0
robert
Top achievements
Rank 1
answered on 21 Jun 2009, 02:26 PM
I have tried the following events:
RadPanelBar1_PreRender
RadPanelBar1_Init
Page_Init
Page_Load

I hope I missed one, which would make the solution easier.




0
Accepted
-DJ-
Top achievements
Rank 1
answered on 21 Jun 2009, 04:11 PM
Hi robert,

I just threw it in page_load and it worked.

Is is possible that you are confusing the items, and that you actually want to hide the parentitem of the EmployeeInformation Item?
The parentitem has the text: "Step 2: Employee information", but it's not the item with the value EmployeeInformation...

Regards,
-DJ-
0
robert
Top achievements
Rank 1
answered on 21 Jun 2009, 08:31 PM
Wonderful, that worked. Sorry for the mistake.

Cheers,

Robert.
Asked by
robert
Top achievements
Rank 1
Answers by
-DJ-
Top achievements
Rank 1
robert
Top achievements
Rank 1
Share this question
or