Store TotalCount in ViewState
You can use the ? operator :

const string TOTAL_COUNT_KEY = "totalCount";
private int TotalCount
{
    get
    {
        return ViewState[TOTAL_COUNT_KEY] != null ? (int)ViewState[TOTAL_COUNT_KEY] : 0;
    }
    set { ViewState[TOTAL_COUNT_KEY] = value; }
}


You can use the null propagation operator ?.

const string TOTAL_COUNT_KEY = "totalCount";
private int TotalCount
{
    get
    {
        return ((int?)ViewState[TOTAL_COUNT_KEY])?.Value ?? 0;
    }
    set { ViewState[TOTAL_COUNT_KEY] = value; }
}


It works this way: 


We cast the ViewState[TOTAL_COUNT_KEY] to int?, 
This way, it is either null or the value (let's say 42). 
Then, the ?. operator will return null if the viewstate property is null, otherwise it'll return the value, 42.
If it is null, the ?? operator will return 0.


I think the ? operator is the clearest, the second one is a little more ninja and might not be appropriate if some member of your team (if you have one) don't fully understand the operators.