Question: I am getting Specified cast is not valid error in this method

```
public Dictionary<byte, string> getTeamList(int id1, Dictionary<byte, int> myList)
{    
    Dictionary<byte, string> result = new Dictionary<byte, string>();
    var query= _dataContext.usp_getItem();
    foreach(var item in query)
    {
        if (myList.ContainsKey(item.ID)
        {
            int count= _dataContext.usp_getCountPerID(id1, item.ID).FirstOrDefault().Count;
            if (myList[item.ID] > count)
            {
                result.Add(item.ID, item.Name);
            }
        }
        else
        {
            result.Add(item.ID, item.Name);
        }
    }
    return result;
} 

```

I'm getting the InvalidCastException error at this line:

```
int count = _dataContext.usp_getCountPerID(item.ID).FirstOrDefault().Count;

```

The type of Count is int. It works when I comment out this line of code. 

**UPDATE**

usp\_getCountPerID looks like this:

```
@ID1 INT,
@ID2 TINYINT
SELECT COUNT(ID) AS Count  //I'm changing this name so it's actually not "Count"
FROM   Table
WHERE  ID1 = @ID1
       AND ID2 = @ID2

```

Answer: 
Was able to work on a fix. Instead of relying on a behavior on every click. Since, slickquiz did load the < li > prior and just show and hide. Initially, I must load the proper image as well.

The fix was pretty simple.

```
questionHTML.append('<div class="questionImage"><img id="qImgSrc" src="/themed/aac-theme/img/quizzes/s' +surveyId+ 'q0' + count + '.jpg" border="0" width="300" height="120" alt="" />' + '</div>');

```

For anyone needing this code, it has been modified to have a jquery ui progress bar as well.

Enjoy!
```
'questionHTML.append('' + '');'
```