Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8730799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:05:58+00:00 2026-06-13T09:05:58+00:00

I have a rad grid bound to a collection of custom objects and occasionally

  • 0

I have a rad grid bound to a collection of custom objects and occasionally I grab a rows index like this:

e.Item.ItemIndexHierarchical

at some point later when I want to retrieve that item (if it still exists) I use this:

gvAgendaItems.Items(HierarchicalIndexKey)

The problem is that sometimes the item doesn’t exist anymore – and I’m OK with that – but I’d like to gracefully skip over the section of code that is working on the items it can find. As it stands, searching for an item using a no longer valid key throws an exception so I can’t just check if the resulting item is nothing.

How can I test if that HierarchicalIndexKey is still valid without throwing an exception?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:05:59+00:00Added an answer on June 13, 2026 at 9:05 am

    I don’t see any elegant ways to do this in the Telerik documentation (leaving only blunt/inefficient ways, unfortunately).

    You could loop through the items and match the HierarchicalIndexKey on each item’s ItemIndexHierarchical:

    int i = 0;
    bool bIndexExists = false;
    GridDataItem item = null;
    
    for (i = 0; i <= gvAgendaItems.Items.Count - 1; i++) {
        bIndexExists = gvAgendaItems.Items(i).ItemIndexHierarchical == HierarchicalIndexKey;
        if (bIndexExists) {
            item = gvAgendaItems.Items(HierarchicalIndexKey);
            break;
        }
    }
    

    You could wrap it in a Try/Catch block and simply fail silently.

    GridDataItem item = null;
    
    try {
        item = gvAgendaItems.Items(HierarchicalIndexKey);
    } catch (Exception ex) {
        //fail silently without throwing an exception.
    }
    

    Looping will be more efficient with smaller datasources, where as wrapping will be more efficient with larger datasources (the breakpoint is when it takes more time to loop through the collection than it does to throw an exception).

    Wish I had a better answer, but I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rad grid where I can insert/update and delete items of data.
I have a telerik rad grid with PageSize=10. The problem is if I have
I have a Telerik RadGrid. The initial DataSource that is bound to the grid
I have a Rad Grid View that I'm using to display some data and
I have a RadGrid bound to a LinqDataSource. The grid has auto generated Edit
I have a Rad Grid and I simply want the cursor to be a
i have a rad grid with the following code <telerik:GridTemplateColumn> <ItemTemplate> <asp:LinkButton ID=Delete Text=Remove
this is my rad grid column <telerik:GridImageColumn HeaderText=Image DataImageUrlFields=ContentName DataType=System.String DataImageUrlFormatString=~/SlideImages/{0} UniqueName=Upload Visible=false ImageHeight=80px
I have a GridBoundColumn that I would like to be bound to 2 fields
I invoke one function in javascript. When I call this function rad grid row

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.