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 54:                 str += "<tr>";
Line 55:                 str += "<td>" + "</td>";
Line 56:                 str += "<td><a href='../" + dt.Rows[k][2].ToString().Substring(2) + "' target='_blank' rel='noopener' > <img src='" + srcimg + "' Style='height: 13px; '/>" + dt.Rows[k][1].ToString() + "</a></td>";
Line 57:                 //str += "<td>" + dt.Rows[k][3].ToString() + "</td>";
Line 58:                 str += "</tr>";

Source File: e:\codedata\Minority_New_122.88\50062\Directorate\NoticeBoard.aspx.cs    Line: 56

Stack Trace:


[ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex]
   System.String.Substring(Int32 startIndex, Int32 length) +13148821
   System.String.Substring(Int32 startIndex) +16
   Directorate_NoticeBoard.AboutDirectorate() in e:\codedata\Minority_New_122.88\50062\Directorate\NoticeBoard.aspx.cs:56
   Directorate_NoticeBoard.Page_Load(Object sender, EventArgs e) in e:\codedata\Minority_New_122.88\50062\Directorate\NoticeBoard.aspx.cs:13
   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.4682.0