When i click on the link button present inside the gridview after it has been loaded i get stack overflow error

When i click on the linkbutton present inside the gridview, after it has been loaded, i get stack overflow error at line '0'.Is this the problem in the datatype overflow.

Can You tell me what may be the problem and where exactly i have to use stackoverflow exception.
SukeshjphAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SteveH_UKCommented:
Stack overflow is caused by one of two things:

1)  Too many method calls.  This normally indicates that there is cyclic behaviour, for example method1 calls method2 which calls method3 which calls method1 which calls method2 which calls method3 ...

2)  Too much memory allocated on the stack.  This may be for structures, but in general this doesn't occur in .NET, but was common in C++ applications

I would put a breakpoint in your LinkButton_Click handler and see what it is doing.
0
gocemiCommented:

if you comment the code inside the link button ( comment all code inside the method) , rebuild and click again... do you get the error again?

if so, can you send the code that executes inside the link button clicked?

0
SukeshjphAuthor Commented:
My code in the onrowcommand is like this......

protected void gvFriendsUpdatedDetails_RowCommand(object sender, GridViewCommandEventArgs e)
    {
try
{

    {

        switch (e.CommandName)
        {
            case "Check":
                DateTime StartTime;
                DateTime EndTime;
                DateTime Span = System.DateTime.Today.Date.AddDays(-8);

                StartTime = Convert.ToDateTime(Span.AddDays(1).ToString().TrimEnd(("12:00:00 AM ").ToCharArray()));
                EndTime = Convert.ToDateTime(Span.AddDays(8).ToString().TrimEnd(("12:00:00 AM").ToCharArray()));
                int index = Convert.ToInt32(e.CommandArgument);
                Label lblMediaID = (Label)gvFriendsUpdatedDetails.Rows[index].FindControl("lblid");

                PersonId = Convert.ToInt64((lblMediaID.Text).ToString());
                ViewState["ClickedUserID"] = PersonId;


                LinkButton lnkProf = (LinkButton)gvFriendsUpdatedDetails.Rows[index].FindControl("lnkBtnProfessional");
                LinkButton lnkEdu = (LinkButton)gvFriendsUpdatedDetails.Rows[index].FindControl("lnkbtnEducational");
                LinkButton lnkPer = (LinkButton)gvFriendsUpdatedDetails.Rows[index].FindControl("lnkBtnPersonal");
                LinkButton lnkprofile = (LinkButton)gvFriendsUpdatedDetails.Rows[index].FindControl("lnkbtnProfile");
                Label lblMsg = (Label)gvFriendsUpdatedDetails.Rows[index].FindControl("lblMessage");



                serviceObject = new NetworkUpdateService();

                if (Convert.ToBoolean(ViewState["ForTodayOrOLd"]) == true)
                {

                    statusProfSingle = serviceObject.getProfessionalSingleStatus(PersonId, System.DateTime.Today);

                    statusEdu = serviceObject.getEducationalStatus(PersonId, System.DateTime.Today);
                    statusPersnl = serviceObject.getPersonalStatus(PersonId, System.DateTime.Today);
                    stausProfile = serviceObject.getProfileStatus(PersonId, System.DateTime.Today);
                    //ViewState["ForTodayOrOLd"] = false;
                }
                else
                {
                    statusProfSingle = serviceObject.getProfessionalSingleStatus(PersonId, StartTime, EndTime);
                    statusEdu = serviceObject.getEducationalStatus(PersonId, StartTime, EndTime);
                    statusPersnl = serviceObject.getPersonalStatus(PersonId, StartTime, EndTime);
                    stausProfile = serviceObject.getProfileStatus(PersonId, StartTime, EndTime);
                }


                if (!(statusProfSingle == false && statusEdu == false && statusPersnl == false && stausProfile == false))
                {
                    lblMsg.Visible = true;
                }

                if (statusProfSingle == true)
                    lnkProf.Visible = true;
                else
                    lnkProf.Visible = false;

                if (stausProfile == true)
                    lnkprofile.Visible = true;
                else
                    lnkprofile.Visible = false;

                if (statusEdu == true)
                    lnkEdu.Visible = true;
                else
                    lnkEdu.Visible = false;

                if (statusPersnl == true)
                {
                    lnkPer.Visible = true;
                }
                else
                {
                    lnkPer.Visible = false;
                }

                break;

            case "Professional":
                Response.Redirect("../Default.aspx?Id=" + ViewState["ClickedUserID"].ToString());

                break;
            case "Educational":
                Response.Redirect("../Default.aspx?Id=" + ViewState["ClickedUserID"].ToString());
                break;
            case "Personal":
                Response.Redirect("../Default.aspx?Id=" + ViewState["ClickedUserID"].ToString());
                break;
            case "Profile":
                Response.Redirect("../Default.aspx?Id=" + ViewState["ClickedUserID"].ToString());
                break;
       
    }

   



   
    #endregion
   

}


}
catch (StackOverflowException ex)
{


}


    }

I am working in c#.net...as u told i am doing a lot of method calls to determine whether to make some buttons visible or false....professional,personal,educational...buttons...but i think when i click on the firstname button i want to display these buttons according to their status.....but the time i get the data i also get stack oveflow error at line 0..but i am getting my result also....
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

SukeshjphAuthor Commented:
I am not gettin any stackoverflow exception in this code but still i am getting the error...
0
gocemiCommented:
I think that only place where you can get this exception is
if (Convert.ToBoolean(ViewState["ForTodayOrOLd"]) == true)
                {

                    statusProfSingle = serviceObject.getProfessionalSingleStatus(PersonId, System.DateTime.Today);

                    statusEdu = serviceObject.getEducationalStatus(PersonId, System.DateTime.Today);
                    statusPersnl = serviceObject.getPersonalStatus(PersonId, System.DateTime.Today);
                    stausProfile = serviceObject.getProfileStatus(PersonId, System.DateTime.Today);
                    //ViewState["ForTodayOrOLd"] = false;


serviceObject - is this your implementation?

can you identigy on which line this error is thrown?
0
SukeshjphAuthor Commented:
Serviceobject is another component or layer which again calls the required method of data accesslayer ...dataacess layer calls the stored procs and delivers the dataset to servicelayer and in turn servicelayer to user interface then... getprofstatus returns true or false based on that the linkbutton becomes visible=true or false...


I think there is no error....no exceptiion and data comes to gridview fine but the moment linkbuttons are visible another pop up comes "Stack overflow error at line 0".I don't know why this pop up is coming....
0
gocemiCommented:
this is error that is thrown on server and since you are using Ajax they are displayed in alert.

If you turn off Ajax and go trough standard post back you should see the error.

Also check the event logs (administrative tools->event viewer) there should be something written also.
0
SukeshjphAuthor Commented:
But i am not using ajax....is there any possibility of error what i think...

Personid which is a person's id i get it from a lable control .when passed to the servicelayer i get userid as a hexadecimal number like(0*4562400jt) rather than simple "1000" or ''1002".
 
I suspect here in this point i get some error...but even if i changed in to
PersonId = int.Parse((lblMediaID.Text).ToString());

previously it was like this
 PersonId = Convert.ToInt64((lblMediaID.Text).ToString());

i still get this error.
0
gocemiCommented:
if there is a problem with format of the number i think you should get number format exception or maybe out of range something...

But it seems that you are receiving javascript error

try this
http://www.webdeveloper.com/forum/archive/index.php/t-33308.html
or
http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_21591311.html
or
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_22007642.html

Probably you get javascript errors, can you check code that executes when you cliick on the button or when page is loaded?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.