Server Error in '/' Application.

startIndex cannot be larger than length of string.
Parameter name: startIndex

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex

Source Error:


Line 95:     public void Bindfy(int fy)
Line 96:     {
Line 97:         ltlfy.Text = fy.ToString() + "-" + (Convert.ToInt32(fy.ToString().Substring(2,2))+1);
Line 98: 
Line 99:         //dt = oDcDirDetailsBLL.MasterSelectData("financialyear", fy);

Source File: e:\netdocs\msme_dashboard\clcss_CummulativeState.aspx.cs    Line: 97

Stack Trace:


[ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex]
   System.String.Substring(Int32 startIndex, Int32 length) +13148821
   clcss_CummulativeState.Bindfy(Int32 fy) in e:\netdocs\msme_dashboard\clcss_CummulativeState.aspx.cs:97
   clcss_CummulativeState.Page_Load(Object sender, EventArgs e) in e:\netdocs\msme_dashboard\clcss_CummulativeState.aspx.cs:34
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +52
   System.Web.UI.Control.OnLoad(EventArgs e) +97
   System.Web.UI.Control.LoadRecursive() +61
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +693


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4700.0