As suggested by PIEBALDconsult in their comment...
Put a breakpoint on the line
PageNumber = Convert.ToInt32(e.CommandArgument) - 1;
Examine the contents of
e.CommandArgument
It might be
null
, it might be text such as "Empty". Whatever it is it will not be the string form of any integer so the
Convert.ToInt32
will fail.
Place a check before the code e.g.
if(e.CommandArgument != null)
{
PageNumber = Convert.ToInt32(e.CommandArgument) - 1;
BindRepeaterData();
}
[EDIT - update in light of new information]
Match match = Regex.Match(e.CommandArgument, @"\d+", RegexOptions.IgnorePatternWhitespace);
if(match.Success)
{
PageNumber = Convert.ToInt32(match.ToString) - 1;
BindRepeaterData();
}
You will also need the following
using System.Text.RegularExpressions;