Click here to Skip to main content
15,917,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
protected void asd_Click(object sender, EventArgs e)
        {
            if (Common.Common.ApplicationInformation.LoggedInUser.RGroupIds != null)
            {
                string Documentid = string.Empty;
                string GroupIds = string.Empty;
                string DocumentIds = string.Empty;
                string ContactIds = string.Empty;
                //----------------
                if (Session["ReportDocumentIDs"].ToString() != null)
                {
                    DocumentIds = Session["ReportDocumentIDs"].ToString();
                    Documentid = DocumentIds.Substring(0, DocumentIds.LastIndexOf(','));
                }
                else
                {
                    Documentid = null;
                }

In the bold line i got the error ,plz some one help me .urgent
Posted

1 solution

This might be due to the line
DocumentIds.LastIndexOf(',')

check that is there any "," in your decumentids string?

you can check
if(DocumentIds.Contains(","))
  Documentid = DocumentIds.Substring(0, DocumentIds.LastIndexOf(','));
else
  // some code here
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900